Http & Https Implementation
This drb-impl-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.impl.
The implementation name is http.
The factory class is encoded into drb_impl_http.drb_impl_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-impl-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 the
http content en header. The content is accessible with value node class
attribute. It shall also be possible to retrieve specific streamed
implementation using get_impl methode.
The URL HTTP GET response header of the given URL is accessible via
attributes of the node.
from drb_impl_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_impl_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_impl_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.
Limitations
None
Documentation
The documentation of this implementation can be found here https://drb-python.gitlab.io/impl/http
Metadata
Release files for drb-impl-http 1.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| drb-impl-http-1.0.9.tar.gz | 27.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| drb_impl_http-1.0.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.4 kB
Release files / drb-impl-http-1.0.9.tar.gz
| Download URL | drb-impl-http-1.0.9.tar.gz |
|---|---|
| Size | 27.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
964ca388e0f29ab19661761d3c81c8d6734f1ecbbb259bd7ffd6f909fc0dbcf6
|
|
BLAKE2b-256 checksum How to use checksums |
4d218820ed52c556dfb3fe2339af8a1e81586fdde6fd362d12e406eb7d9637c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/5.0.0 pkginfo/1.8.3 requests/2.27.1 requests-toolbelt/0.10.0 tqdm/4.64.1 CPython/3.8.15
|
Release files / drb_impl_http-1.0.9-py3-none-any.whl
| Download URL | drb_impl_http-1.0.9-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b2e996e0d80b2e759e93040f82d9d37f47ead648c86b8b7042015711f8078d9
|
|
BLAKE2b-256 checksum How to use checksums |
130060f58d7416089bc1514a8631efea3bd0d094c2c5485d36f3e53f15d6d092
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/5.0.0 pkginfo/1.8.3 requests/2.27.1 requests-toolbelt/0.10.0 tqdm/4.64.1 CPython/3.8.15
|