{"id":9479,"library":"apimatic-requests-client-adapter","title":"APIMatic Requests Client Adapter","description":"`apimatic-requests-client-adapter` is a Python library that provides an adapter for the popular `requests` HTTP client library. It is specifically designed to be consumed by SDKs generated with APIMatic, allowing them to leverage `requests` for making HTTP calls while integrating APIMatic's configuration, retry logic, and other features. The library is actively maintained with a somewhat irregular but frequent release cadence, and its current version is 0.1.10.","status":"active","version":"0.1.10","language":"python","source_language":"en","source_url":"https://github.com/apimatic/requests-client-adapter","tags":["api-client","http-client","requests-adapter","sdk-generation","apimatic"],"install":[{"cmd":"pip install apimatic-requests-client-adapter","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core HTTP client library that this package adapts.","package":"requests"},{"reason":"Provides core utilities and configuration classes like `RequestsClientConfig` that are essential for configuring the adapter.","package":"apimatic-core"},{"reason":"Used for date parsing and formatting within APIMatic's ecosystem.","package":"python-dateutil"}],"imports":[{"note":"The `RequestsClient` class is located within the `requests_client` submodule, not directly under the top-level package.","wrong":"from apimatic_requests_client_adapter import RequestsClient","symbol":"RequestsClient","correct":"from apimatic_requests_client_adapter.requests_client import RequestsClient"},{"note":"While used by this adapter, `RequestsClientConfig` is part of `apimatic-core`, not this library itself.","symbol":"RequestsClientConfig","correct":"from apimatic_core.request_builders.requests_client_config import RequestsClientConfig"}],"quickstart":{"code":"from requests import Session\nfrom apimatic_core.request_builders.requests_client_config import RequestsClientConfig\nfrom apimatic_requests_client_adapter.requests_client import RequestsClient\n\n# 1. Configure the RequestsClient using RequestsClientConfig\n# This object defines behaviors like timeouts, retries, and proxy settings.\nclient_config = RequestsClientConfig(\n    timeout=30,\n    max_retries=3,\n    backoff_factor=0.5,\n    retry_status_codes=[408, 413, 429, 500, 502, 503, 504],\n    verify=True,\n    # Proxy support added in v0.1.8+\n    # proxies={'http': 'http://my.proxy.com:8080', 'https': 'https://my.proxy.com:8080'}\n)\n\n# 2. Optionally, create a pre-configured requests.Session object.\n# This allows sharing session state (like cookies) across requests.\nsession = Session()\n# You could configure the session further here, e.g., session.proxies = {'http': '...', 'https': '...'}\n\n# 3. Instantiate the RequestsClient adapter.\n# This client implements the IHttpClient interface expected by APIMatic SDKs.\n# If requests_session is not provided, an internal Session is created.\n# If client_config is not provided, default configurations are used.\nrequests_client_adapter = RequestsClient(\n    requests_client_config=client_config,\n    requests_session=session\n)\n\nprint(f\"APIMatic Requests Client Adapter created. Timeout: {requests_client_adapter._requests_client_config.timeout}s\")\n# This adapter is typically passed to an APIMatic-generated SDK client, e.g.:\n# my_sdk_client = MyAPISDKClient(http_client_instance=requests_client_adapter)","lang":"python","description":"This quickstart demonstrates how to instantiate the `RequestsClient` adapter. It involves creating a `RequestsClientConfig` object (from `apimatic-core`) to define HTTP client behavior and optionally a `requests.Session` for advanced session management. The `RequestsClient` instance is then ready to be passed into an APIMatic-generated SDK client."},"warnings":[{"fix":"Ensure you are using the `RequestsClient` as intended, typically by injecting it into an APIMatic-generated SDK client instance.","message":"This library is primarily an internal component for APIMatic-generated SDKs. While you can instantiate `RequestsClient` directly, its main purpose is to be passed as an `IHttpClient` interface implementation to an SDK client for making API calls. Direct standalone usage for raw HTTP requests is less common; for that, consider using the `requests` library directly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to version 0.1.8 or newer and use the `proxies` dictionary parameter within `RequestsClientConfig` for straightforward proxy setup.","message":"Older versions (prior to 0.1.8) lacked first-class proxy support via the `RequestsClientConfig`. While proxies could be configured manually on a `requests.Session` object, direct configuration through the `client_config` was not available.","severity":"deprecated","affected_versions":"<0.1.8"},{"fix":"Upgrade to version 0.1.9 or newer. This version introduced support for passing a custom `requests.Session` object directly to `RequestsClient` or injecting a custom HTTP client instance via `http_client_instance` in `RequestsClientConfig`.","message":"Prior to version 0.1.9, injecting an arbitrary custom HTTP client or a pre-configured `requests.Session` directly through a defined interface was less flexible. This could complicate scenarios requiring highly customized HTTP client behavior beyond what `RequestsClientConfig` offered.","severity":"gotcha","affected_versions":"<0.1.9"},{"fix":"Consult the GitHub releases page or changelog for your specific versions before upgrading, paying close attention to any mentioned breaking changes or necessary migration steps.","message":"As a 0.x.x version library, minor version updates (e.g., 0.1.x to 0.2.x) can introduce breaking changes without strictly adhering to semantic versioning. Always review the GitHub release notes when updating across minor versions.","severity":"breaking","affected_versions":"All 0.x.x versions"}],"env_vars":null,"search_vec":"'0.1.10':74 'activ':59 'adapt':4,9,17,83 'allow':37 'api':76 'api-cli':75 'apimat':1,6,36,48,87 'apimatic-requests-client-adapt':5 'cadenc':68 'call':45 'client':3,8,23,77,80 'configur':50 'consum':31 'current':71 'design':28 'featur':55 'frequent':66 'generat':34,86 'http':22,44,79 'http-client':78 'integr':47 'irregular':64 'leverag':40 'librari':13,24,57 'logic':52 'maintain':60 'make':43 'popular':20 'provid':15 'python':12 'releas':67 'request':2,7,21,41,82 'requests-adapt':81 'retri':51 'sdk':85 'sdk-gener':84 'sdks':33 'somewhat':63 'specif':27 'version':72","created_at":"2026-04-17T01:19:07.835176+00:00","updated_at":"2026-04-17T01:19:07.835176+00:00","problems":[{"fix":"Run `pip install apimatic-requests-client-adapter` to install the library.","cause":"The `apimatic-requests-client-adapter` library is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'apimatic_requests_client_adapter'"},{"fix":"Upgrade both `apimatic-requests-client-adapter` and `apimatic-core` to their latest versions: `pip install --upgrade apimatic-requests-client-adapter apimatic-core`.","cause":"You are trying to use a configuration parameter (like `proxies` or `http_client_instance`) that was introduced in a newer version of `apimatic-requests-client-adapter` or `apimatic-core` with an older installed version.","error":"TypeError: RequestsClientConfig.__init__() got an unexpected keyword argument 'proxies'"},{"fix":"Run `pip install apimatic-core` to install the dependency.","cause":"The `apimatic-core` library, which provides the `RequestsClientConfig` class essential for configuring `RequestsClient`, is not installed.","error":"ModuleNotFoundError: No module named 'apimatic_core'"},{"fix":"Instantiate an APIMatic-generated SDK client and pass the `RequestsClient` instance to it. If you need raw `requests`-style functionality, use the `requests` library directly.","cause":"You are attempting to use the `RequestsClient` adapter directly like a `requests.Session` object to make HTTP requests. `RequestsClient` implements an `IHttpClient` interface and is meant to be passed to an APIMatic-generated SDK client, which then exposes the high-level API methods.","error":"AttributeError: 'RequestsClient' object has no attribute 'get'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.1.10","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/apimatic/requests-client-adapter","docs":null,"changelog":null,"pypi":"https://pypi.org/project/apimatic-requests-client-adapter/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}