Skip to main content

FitRequest

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.

Skillcorner Coverage Build PyPI - Version Versions License Twitter Follow


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 and support JSONPath exploration for JSON responses.
  • Docstring Templating: Generate meaningful docstrings for each method.
  • 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 @retry decorator 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.

Installation

pip install fitrequest

A Simple Example

from fitrequest.client import FitRequest

class RestApiClient(FitRequest):
    """Awesome class generated with FitRequest."""

    client_name = 'rest_api'
    base_url = 'https://test.skillcorner.fr'
    method_docstring = 'Calling endpoint: {endpoint}'

    method_config_list = [
        {
            'base_name': 'items',
            'endpoint': '/items/',
            'add_async_method': True,
        },
        {
            'name': 'get_item',
            'endpoint': '/items/{item_id}',
        },
        {
            'name': 'get_item_details',
            'endpoint': '/items/{item_id}/details/{detail_id}',
        },
    ]

client = RestApiClient()

With the above class, you can perform the following actions:

# Synchronous calls
response = client.get_item(item_id=3)
response = client.get_item_details(item_id=3, detail_id=7)
response = client.get_items()

# Asynchronous calls
response = await client.get_items()

Help

See documentation for more details.


Contact

For support, contact the Skillcorner Team: support@skillcorner.com.

Metadata

Release files for fitrequest 1.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fitrequest 1.5.3
File Size Uploaded Provenance
fitrequest-1.5.3.tar.gz 465.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fitrequest 1.5.3
File Interpreter ABI Platform
fitrequest-1.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 505.8 kB

Release files / fitrequest-1.5.3.tar.gz

Download URL fitrequest-1.5.3.tar.gz
Size 465.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f45ba6704017a570ad5d0a343f86f3d2bd0d352247fbd8bb580958c2b2a71f40
BLAKE2b-256 checksum
How to use checksums
c5e9cb7ef6088e90848146f6552ed16ac0b6d3ea25601ecc911043c25543210d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.13

Release files / fitrequest-1.5.3-py3-none-any.whl

Download URL fitrequest-1.5.3-py3-none-any.whl
Size 40.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92735b27cdf461d358a29976a945fd5b9ecd60337e8a55042ce91936ac1e262a
BLAKE2b-256 checksum
How to use checksums
8c96be74f7275a60aa6d54367ef31957f9cfe3ca7f1f7e0e1619ee511356c3f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.13

Security for fitrequest 1.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.5.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page