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.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-py2.py3-none-any.whl (6.6 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: requests_glob-0.3.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.tar.gz
Algorithm Hash digest
SHA256 7d68a69c22b307d2c0cd1ae4a26c5d40545bb8b3956fe935a44e867e303496e7
MD5 f045558c4a4f736a8ef4b561604a1b1a
BLAKE2b-256 522244ee3366bfecf57f8c14d003cca300a52db26036dcd6cd473c59e9862ec3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: requests_glob-0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for requests_glob-0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a34f54896141566fae259d1840edcf825c2b30af7d9a0a9e2c15910e47a2827d
MD5 c579b50ce2ad87bec8b45dabe86048cf
BLAKE2b-256 21c1749e71c5801b23c890b0fdabf7e5069a188629f6d0182a1f758334f75bd7

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