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 PyPI - Version Versions 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.6.0

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.6.0
File Size Uploaded Provenance Actions
fitrequest-1.6.0.tar.gz 31.1 kB Without provenance Details for fitrequest-1.6.0.tar.gz

Built distribution (wheel)

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

Total release size: 71.3 kB

Release files / fitrequest-1.6.0.tar.gz

Download URL fitrequest-1.6.0.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2daa19a7cdb035ab5500a039a725c90316cffba7ca261c603e5223abf04ba91a
BLAKE2b-256 checksum
How to use checksums
1d70805481ef8de29d9530caa30635b6eed61e3b802c67782d92fe8348014ae0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL fitrequest-1.6.0-py3-none-any.whl
Size 40.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0b2318e0916d7773fc5f826c6f0948ee859d236623d9431bd91254288989c00
BLAKE2b-256 checksum
How to use checksums
ce6bc5c0ee50315103963c8c036cf30d61be7b36c7b6792541d60e576145543d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for fitrequest 1.6.0

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.6.0 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