Welcome to FitRequest#
Overview#
fitrequest is a Python library designed to simplify the creation of REST API clients by automating code generation. It enables developers to generate both synchronous and asynchronous methods for interacting with REST APIs, handle response formatting, and manage authentication seamlessly.
Key Features#
What This Module Does#
Easy Synchronous and Asynchronous Code Generation
Quickly create methods to interact with REST endpoints.
Response Formatting
Automatically handle JSON and XML responses, support JSONPath exploration and Pydantic formatting for JSON responses.
Docstring Templating
Generate meaningful docstrings for each method using Jinja templates.
Basic Authentication
Support basic authentication using environment variables or AWS secrets.
FitRequest Variable Management
Easily retrieve data from AWS, system environment variables, or set default values.
Argument Generation
Automatically generate method arguments based on endpoint variables.
Decorator handling
Easily enhance generated fitrequest methods with custom decorators.
Retry Behavior
A
@retrydecorator is provided to allow user to implement basic retry logic.Rich syntax options
Several syntax options provided that can be tailored to your needs and preferences.
Auto-generated CLI
An out-of-the-box CLI is provided with fitrequest classes to easily test methods from a terminal.
What This Module Doesn’t Do#
Handle OpenApi
Generate python clients from OpenAPI documents. This may be a future feature.
Complex Authentication
For complex authentication, use a custom HTTPX Authentication method or directly provide the auth argument to the generated method.
Multiple Request Methods
Generates only one method per endpoint.
XML/HTML Parsing
Limited support for extracting data from XML and HTML.
Streaming Handling
Does not handle streaming requests/responses. This may be a future feature.
Useful Links#
Code: fitrequest GitLab
Pypi: fitrequest PyPI
Contents#
- Getting Started
- FitRequest Variables (FitVar)
- Authentication
- Session Update
- Configuration Formats
- Response Formatting
- Params Formatting
- Command Line
- Pickling
- Pagination
- Examples
- Developer Interface
- Auth
- AWSVar
- AWSSecretTypeEnum
- AWSRegionEnum
- CLI
- FitRequest
- FitRequestBase
- Errors
- FitConfig
- FitVar
- Generator
- MethodConfig
- MethodConfigFamily
- MethodConfigGroup
- Method Decorator Validation
- Method Models And Signatures
- Request Params
- Response
- ResponseFormatter
- Response Models
- Session
- Templating
- Token Authentication
- Utils
- Decorators