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://github.com/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-1.3.1.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file requests-file-1.3.1.tar.gz.

File metadata

  • Download URL: requests-file-1.3.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for requests-file-1.3.1.tar.gz
Algorithm Hash digest
SHA256 b62bb8920dcf7d50aa28d8c1e4502917db58c50b8ed3ce9a262fadb1571070d4
MD5 35c06e4bbd64556adc102680d1ffb007
BLAKE2b-256 1a31b473744c6297032d98af221aae1fa333c89faa4e184ea61a39fef0c2ea46

See more details on using hashes here.

Release history Release notifications | RSS feed

3.0.1

2 files

3.0.0

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

This release

1.3.1 This release

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