Http & Https Implementation
This drb-driver-http module implements http and https protocol access with DRB data model.
Http Factory and Http Node
The module implements the factory model defined in DRB in its node resolver. Based on the python entry point mechanism, this module can be dynamically imported into applications.
The entry point group reference is drb.driver.
The implementation name is http.
The factory class is encoded into drb.drivers.http.
The http signature id is b065a5aa-35a3-11ec-8d3d-0242ac130003
The https signature id is c18ef57c-3673-11ec-8d3d-0242ac130003
The HttpNode can be instantiated from an uri. The ParsedPath class provided in drb core module can help to manage these inputs.
Using this module
The project is present in https://www.pypi.org service. it can be freely loaded into projects with the following command line:
pip install drb-driver-http
Access Data
DrbHttpNode manages the http protocol to access remote data. The construction
parameter is an url. Both http and https are supported. They allow access to the
http content and header. The content is accessible with value node class
attribute. It shall also be possible to retrieve specific streamed
implementation using the get_impl method.
The URL HTTP GET response header of the given URL is accessible via
attributes of the node.
from drb.drivers.http import DrbHttpNode
node = DrbHttpNode('https://gitlab.com/drb-python/impl/http/-/raw/main/README.md')
print(node.name)
print(node.attributes)
print(node.path)
print(node.value)
HTTP protocol does not allow navigation inside http path so this implementation is not able to provide any children of the same HTTP type.
Authentication
Http node is able to manage Basic authentication based on username and
password, as well as OAuth2.0 authentication based on token.
It should also support Digest authentication via requests package
HTTPDigestAuth implementation.
Basic Auth
To implements Basic authentication connection, the HTTPBasicAuth class
from requests package is used.
from requests.auth import HTTPBasicAuth
from drb.drivers.http import DrbHttpNode
auth = HTTPBasicAuth('username', 'password')
node = DrbHttpNode('https://www.gael.fr', auth=auth)
OAuth2.0 connection
A dedicated HTTPOAuth2 class is available to manage OAuth2.0 authentication.
It allows token retrieval and refresh when expired.
from drb.drivers.http import DrbHttpNode, HTTPOAuth2
svc_url = 'https://www.gael-systems.com/service'
token_svc = 'https://auth.gael-systems.com/token'
user = 'user'
password = 'pass'
service_id = 'service'
secret = 'secret'
auth = HTTPOAuth2(username=user, password=password, token_url=token_svc,
client_id=service_id, client_secret=secret)
node = DrbHttpNode(svc_url, auth=auth)
The renewal event of the token is triggered by computation. Based on the token expiration delay, the implementation computes the period to create or refresh a new token. Thanks to this mechanism, no unnecessary connection is performed by the client for this stage.
GDAL locator (gdal-vsi)
A node exposes a GDAL /vsicurl locator through get_impl(str, 'gdal-vsi')
(/vsicurl/<url>), so a consumer such as drb-driver-image can let GDAL read
the resource natively over HTTP range requests instead of downloading it
whole. It composes under a container locator, e.g.
/vsizip{/vsicurl/https://.../product.zip}/inner.jp2. When the node carries
authentication (basic, OAuth2, ...), the Authorization header it produces is
forwarded to GDAL's /vsicurl handler through the GDAL_HTTP_HEADERS
environment variable (no GDAL import in this driver). This is process-global,
so a single credential set is assumed per process.
Limitations
The HTTP protocol does not allow navigation inside an http path, so this implementation does not provide any children.
Documentation
The documentation of this implementation can be found here https://drb-python.gitlab.io/impl/http
Metadata
Release files for drb-driver-http 1.5.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 |
|---|---|---|---|---|
| drb_driver_http-1.5.0.tar.gz | 39.8 kB | Without provenance | Details for drb_driver_http-1.5.0.tar.gz |
Release files / drb_driver_http-1.5.0.tar.gz
| Download URL | drb_driver_http-1.5.0.tar.gz |
|---|---|
| Size | 39.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de78820a2e4ab2e804eecdad0a15ceef08ecc0a75923e7f26042564cac7c81f6
|
|
BLAKE2b-256 checksum How to use checksums |
653204dad08ce023a6d7a877cac25f91d608a3ef93a7a7932b0a3eef898b2442
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/9.0.0 pkginfo/1.12.1.2 requests/2.34.2 requests-toolbelt/1.0.0 tqdm/4.68.3 CPython/3.11.15
|
Security for drb-driver-http 1.5.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.