{"id":13502442,"url":"https://github.com/requests/toolbelt","last_synced_at":"2025-05-11T03:40:48.929Z","repository":{"id":12839628,"uuid":"15515181","full_name":"requests/toolbelt","owner":"requests","description":"A toolbelt of useful classes and functions to be used with python-requests","archived":false,"fork":false,"pushed_at":"2025-01-09T01:04:53.000Z","size":809,"stargazers_count":1014,"open_issues_count":95,"forks_count":190,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-07T23:04:54.751Z","etag":null,"topics":["http","python","python-requests","toolbox"],"latest_commit_sha":null,"homepage":"https://toolbelt.readthedocs.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/requests.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.rst","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-29T21:19:08.000Z","updated_at":"2025-05-04T07:36:18.000Z","dependencies_parsed_at":"2023-01-13T17:09:58.612Z","dependency_job_id":"29bc54a3-cdfe-41cd-8c93-7835c51b44c6","html_url":"https://github.com/requests/toolbelt","commit_stats":{"total_commits":471,"total_committers":73,"mean_commits":"6.4520547945205475","dds":"0.46496815286624205","last_synced_commit":"c73ad2c204a2e0cd5617a836ac536d5e06778ab0"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests%2Ftoolbelt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests%2Ftoolbelt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests%2Ftoolbelt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests%2Ftoolbelt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/requests","download_url":"https://codeload.github.com/requests/toolbelt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252968114,"owners_count":21833251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","python","python-requests","toolbox"],"created_at":"2024-07-31T22:02:14.112Z","updated_at":"2025-05-07T23:04:58.979Z","avatar_url":"https://github.com/requests.png","language":"Python","readme":"The Requests Toolbelt\n=====================\n\nThis is just a collection of utilities for `python-requests`_, but don't\nreally belong in ``requests`` proper. The minimum tested requests version is\n``2.1.0``. In reality, the toolbelt should work with ``2.0.1`` as well, but\nsome idiosyncracies prevent effective or sane testing on that version.\n\n``pip install requests-toolbelt`` to get started!\n\n\nmultipart/form-data Encoder\n---------------------------\n\nThe main attraction is a streaming multipart form-data object, ``MultipartEncoder``.\nIts API looks like this:\n\n.. code-block:: python\n\n    from requests_toolbelt import MultipartEncoder\n    import requests\n\n    m = MultipartEncoder(\n        fields={'field0': 'value', 'field1': 'value',\n                'field2': ('filename', open('file.py', 'rb'), 'text/plain')}\n        )\n\n    r = requests.post('http://httpbin.org/post', data=m,\n                      headers={'Content-Type': m.content_type})\n\n\nYou can also use ``multipart/form-data`` encoding for requests that don't\nrequire files:\n\n.. code-block:: python\n\n    from requests_toolbelt import MultipartEncoder\n    import requests\n\n    m = MultipartEncoder(fields={'field0': 'value', 'field1': 'value'})\n\n    r = requests.post('http://httpbin.org/post', data=m,\n                      headers={'Content-Type': m.content_type})\n\n\nOr, you can just create the string and examine the data:\n\n.. code-block:: python\n\n    # Assuming `m` is one of the above\n    m.to_string()  # Always returns unicode\n\n\nUser-Agent constructor\n----------------------\n\nYou can easily construct a requests-style ``User-Agent`` string::\n\n    from requests_toolbelt import user_agent\n\n    headers = {\n        'User-Agent': user_agent('my_package', '0.0.1')\n        }\n\n    r = requests.get('https://api.github.com/users', headers=headers)\n\n\nSSLAdapter\n----------\n\nThe ``SSLAdapter`` was originally published on `Cory Benfield's blog`_.\nThis adapter allows the user to choose one of the SSL protocols made available\nin Python's ``ssl`` module for outgoing HTTPS connections:\n\n.. code-block:: python\n\n    from requests_toolbelt import SSLAdapter\n    import requests\n    import ssl\n\n    s = requests.Session()\n    s.mount('https://', SSLAdapter(ssl.PROTOCOL_TLSv1))\n\ncookies/ForgetfulCookieJar\n--------------------------\n\nThe ``ForgetfulCookieJar`` prevents a particular requests session from storing\ncookies:\n\n.. code-block:: python\n\n    from requests_toolbelt.cookies.forgetful import ForgetfulCookieJar\n\n    session = requests.Session()\n    session.cookies = ForgetfulCookieJar()\n\nContributing\n------------\n\nPlease read the `suggested workflow\n\u003chttps://toolbelt.readthedocs.io/en/latest/contributing.html\u003e`_ for\ncontributing to this project.\n\nPlease report any bugs on the `issue tracker`_\n\n.. _Cory Benfield's blog: https://lukasa.co.uk/2013/01/Choosing_SSL_Version_In_Requests/\n.. _python-requests: https://github.com/kennethreitz/requests\n.. _issue tracker: https://github.com/requests/toolbelt/issues\n","funding_links":[],"categories":["Python","HTTP Clients"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frequests%2Ftoolbelt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frequests%2Ftoolbelt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frequests%2Ftoolbelt/lists"}