httpx-file
Transport adapter fort httpx to allow
file:// URI fetching in the local filesystem.
Installation
pip install httpx-file
Usage
Synchronous
httpx-file subclasses httpx.Client, so you can just replace httpx.Client
with httpx_file.Client to get the same behavior with added file:// protocol
support.
from httpx_file import Client
client = Client()
client.get('file:///etc/fstab)
Or you can also mount FileTransport in a httpx.Client instance.
from httpx_file import FileTransport
from httpx import Client
client = Client(mounts={'file://': FileTransport()})
client.get('file:///etc/fstab)
Asynchronous
It is also possible to use httpx-file possibilities asynchronous way. To do this, you can just replace 'httpx.AsyncClient' with 'httpx_file.AsyncClient'.
from httpx_file import AsyncClient
# Taken from tests/test_transport.py
from pathlib import Path
THIS = Path(__file__)
async def test_async_client():
async_client = AsyncClient()
async_response = await async_client.get(THIS.as_uri())
assert async_response.content == THIS.read_bytes()
Or you can also mount FileTransport in a httpx.AsyncClient instance.
from httpx_file import FileTransport
from httpx import AsyncClient
client = AsyncClient(mounts={'file://': FileTransport()})
client.get('file:///etc/fstab)
Metadata
Release files for httpx-file 0.2.0
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 |
|---|---|---|---|---|
| httpx-file-0.2.0.tar.gz | 4.2 kB | Without provenance | Details for httpx-file-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| httpx_file-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for httpx_file-0.2.0-py3-none-any.whl |
Total release size: 8.7 kB
Release files / httpx-file-0.2.0.tar.gz
| Download URL | httpx-file-0.2.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a00f1dd02c9ffb5e7e072205c30f7ae0d867c397318b045a40b3268f2cdfa932
|
|
BLAKE2b-256 checksum How to use checksums |
b4f7737dbfaa3b3288ce69f75fad9a4cd22cae60d71763618ddd849018895172
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / httpx_file-0.2.0-py3-none-any.whl
| Download URL | httpx_file-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a425b351bf65aa394c02096204dc3fa8b647573a289079f927d3e3abfa3c7c8
|
|
BLAKE2b-256 checksum How to use checksums |
f49c4f3fba4c1b5a8919c3f6d407a41df43980c6a03a631d49f458b9546da128
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for httpx-file 0.2.0
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.