Skip to main content

Requests-File is a transport adapter for use with the Requests Python library to allow local filesystem access via file:// URLs.

To use:

import requests
from requests_file import FileAdapter

s = requests.Session()
s.mount('file://', FileAdapter())

resp = s.get('file:///path/to/file')

Features

  • Will open and read local files

  • Might set a Content-Length header

  • That’s about it

No encoding information is set in the response object, so be careful using Response.text: the chardet library will be used to convert the file to a unicode type and it may not detect what you actually want.

EACCES is converted to a 403 status code, and ENOENT is converted to a 404. All other IOError types are converted to a 400.

Contributing

Contributions welcome! Feel free to open a pull request against https://codeberg.org/dashea/requests-file

License

To maximise compatibility with Requests, this code is licensed under the Apache license. See LICENSE for more details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requests_file-3.0.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

requests_file-3.0.0-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file requests_file-3.0.0.tar.gz.

File metadata

  • Download URL: requests_file-3.0.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for requests_file-3.0.0.tar.gz
Algorithm Hash digest
SHA256 68789589cfde7098e8933fe3e69bbd864f7f0c22f118937b424d94d0e1b7760f
MD5 11b300ae2a857b75e66205263bff633a
BLAKE2b-256 fe5e2aca791207e542a16a8cc91fd0e19f5c26f4dff030ee3062deb5606f84ae

See more details on using hashes here.

File details

Details for the file requests_file-3.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for requests_file-3.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 aca222ec94a19310be2a0ed6bdcdebb09058b0f6c3e984af56361c8fca59653c
MD5 5f0379254f215843c3f325f628526cdd
BLAKE2b-256 e485689c218feb21a66919bd667969d4ed60a64db67f6ea5ceb00c9795ae19b0

See more details on using hashes here.

Release history Release notifications | RSS feed

3.0.1

2 files

This release

3.0.0 This release

2 files

2.1.0

2 files

2.0.0

2 files

1.5.1

2 files

1.5.0

2 files

1.4.3

2 files

1.4.2

1 file

1.4.1

2 files

1.4

1 file

1.3.1

1 file

1.3

1.2

1 file

1.1

1 file

1.0

1 file

0.1

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