Skip to main content

File transport adapter for Requests

Project description

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

To use:

import requests
from requests_glob import GlobAdapter

s = requests.Session()
s.mount('glob://', GlobAdapter())

resp = s.get('glob:///glob_expression')

Features

  • Will open and read local files

  • Might set a Content-Length header

  • That’s about it

Also, url can contain query information, such as glob (yes - default, no), glob_include_hidden (no - default, yes), glob_recursive (yes - default, no)

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/huakim/python-requests-glob

License

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

Project 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_glob-0.3.2.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

requests_glob-0.3.2-py2.py3-none-any.whl (6.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file requests_glob-0.3.2.tar.gz.

File metadata

  • Download URL: requests_glob-0.3.2.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for requests_glob-0.3.2.tar.gz
Algorithm Hash digest
SHA256 033685858f597bc058f72995f353cfef91b48bc640749599af0e6ea1eabf35d4
MD5 fd1dc42b1488365f27335c393b2d99fb
BLAKE2b-256 70441223c82f82170e52fef5522f2b05566aa0a8dbb0ef2857babd8eaba2169c

See more details on using hashes here.

File details

Details for the file requests_glob-0.3.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for requests_glob-0.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0e7e44467aec57b806a616d4ab1bca7c6ef7b3097f0a2a2fc4b24025dc7a718a
MD5 d096e0fe4ee62e224f9f14bf372c0d55
BLAKE2b-256 6515cb4705fae31df89a5494faad4c73b8fffc2267a2a7e370613bc065570e32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page