title: README
Synopsis
A file adapter for the Requests library. This adapter is similar to and inspired by Requests-File but with the following changes:
- HEAD requests return a response without content instead of opening the file.
- The following HTTP response headers are set for regular files:
- Content-Length (always)
- Last-Modified (always)
- Content-Type (if successfully detected by the mimetypes package)
- Content-Encoding (if successfully detected by the mimetypes package)
- The request supports URI hosts that resolve to the localhost or any local IP address.
- A convenience function is provided to get a requests.Session object with the provided file adapter already mounted.
Links
GitLab
Other Repositories
Installation
Install the requests_file_adapter package with your Python package manager, e.g.
pip install requests_file_adapter
Usage
Using the get_session function:
import pathlib
from requests_file_adapter import get_session
path = pathlib.Path("example.txt").resolve()
uri = path.as_uri
session = get_session()
resp = session.get(uri)
for header, value in resp.headers.items():
print(header, value)
print(header.content)
Alternatively, create the session without using the get_session function:
import requests
from requests_file_adapter import FileAdapter
session = requests.Session()
session.mount("file://", FileAdapter())
# ...
Metadata
Release files for Requests-File-Adapter 2024.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| requests_file_adapter-2024.3.tar.gz | 8.3 kB | Without provenance | Details for requests_file_adapter-2024.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| requests_file_adapter-2024.3-py3-none-any.whl | Python 3 | none | any | Details for requests_file_adapter-2024.3-py3-none-any.whl |
Total release size: 14.9 kB
Release files / requests_file_adapter-2024.3.tar.gz
| Download URL | requests_file_adapter-2024.3.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f2a4e8742443f48441de7525b579732c054b212ffea97cbccdb4f8f3ddc3d04
|
|
BLAKE2b-256 checksum How to use checksums |
93d0bf8d478324fb1693257467b3024afe1a5bd796eed70adaece4fe3590c6aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.3
|
Release files / requests_file_adapter-2024.3-py3-none-any.whl
| Download URL | requests_file_adapter-2024.3-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b0fa69eb52619484956560fdbf0bb2235225a7ad157227a4b76757357032b50
|
|
BLAKE2b-256 checksum How to use checksums |
3f3e80a1f592df6d41d6a4703c13279c1ddae3b45a1320dfde6109d850e1e6ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.3
|
Security for Requests-File-Adapter 2024.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.