A Python package from the ds-protocol library collection
Project description
ds-protocol-http-py-lib
A Python package from the ds-common library collection.
Installation
Install the package using pip:
pip install ds-protocol-http-py-lib
Or using uv (recommended):
uv pip install ds-protocol-http-py-lib
Quick Start
from ds_protocol_http_py_lib import __version__
print(f"ds-protocol-http-py-lib version: {__version__}")
Usage
Read from a static URL
import uuid
from ds_protocol_http_py_lib.dataset.http import HttpDataset, HttpDatasetSettings
from ds_protocol_http_py_lib.enums import AuthType, HttpMethod
from ds_protocol_http_py_lib.linked_service import OAuth2AuthSettings
from ds_protocol_http_py_lib.linked_service.http import HttpLinkedService, HttpLinkedServiceSettings
linked_service = HttpLinkedService(
id=uuid.uuid4(),
name="my-linked-service",
version="1.0.0",
settings=HttpLinkedServiceSettings(
host="https://api.example.com",
auth_type=AuthType.OAUTH2,
oauth2=OAuth2AuthSettings(
token_endpoint="https://api.example.com/oauth/token",
client_id="my-client",
client_secret="******",
),
),
)
dataset = HttpDataset(
id=uuid.uuid4(),
name="my-dataset",
version="1.0.0",
linked_service=linked_service,
settings=HttpDatasetSettings(
method=HttpMethod.GET,
url="https://api.example.com/data",
),
)
linked_service.connect()
dataset.read()
df = dataset.output
Read from a URL with path parameters
Use {param} placeholders in the URL and supply their values via path_params:
import uuid
from ds_protocol_http_py_lib.dataset.http import HttpDataset, HttpDatasetSettings
from ds_protocol_http_py_lib.enums import AuthType, HttpMethod
from ds_protocol_http_py_lib.linked_service import OAuth2AuthSettings
from ds_protocol_http_py_lib.linked_service.http import HttpLinkedService, HttpLinkedServiceSettings
linked_service = HttpLinkedService(
id=uuid.uuid4(),
name="my-linked-service",
version="1.0.0",
settings=HttpLinkedServiceSettings(
host="https://api.example.com",
auth_type=AuthType.OAUTH2,
oauth2=OAuth2AuthSettings(
token_endpoint="https://api.example.com/oauth/token",
client_id="my-client",
client_secret="******",
),
),
)
dataset = HttpDataset(
id=uuid.uuid4(),
name="my-dataset",
version="1.0.0",
linked_service=linked_service,
settings=HttpDatasetSettings(
method=HttpMethod.GET,
url="https://api.example.com/documents/{document_guid}/original",
path_params={"document_guid": "abc123"},
),
)
linked_service.connect()
dataset.read()
df = dataset.output
# Request is sent to: https://api.example.com/documents/abc123/original
Requirements
- Python 3.11 or higher
Documentation
Full documentation is available at:
Development
To contribute or set up a development environment:
# Clone the repository
git clone https://github.com/grasp-labs/ds-protocol-http-py-lib.git
cd ds-protocol-http-py-lib
# Install development dependencies
uv sync --all-extras --dev
# Run tests
make test
See the README for more information.
License
This package is licensed under the Apache License 2.0. See the LICENSE-APACHE file for details.
Support
- Issues: GitHub Issues
- Releases: GitHub Releases
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ds_protocol_http_py_lib-0.1.0b6.tar.gz.
File metadata
- Download URL: ds_protocol_http_py_lib-0.1.0b6.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8af7c33b4cc2fb3fd2708bf1fa9cadc655f4008aed0265243459178fd3b3071
|
|
| MD5 |
1a72908a8f69285bf6c4bb91610c382c
|
|
| BLAKE2b-256 |
c602b5ae2d4611855863b82cb7fa1a6494493d43286eef0aaf094b178876912f
|
File details
Details for the file ds_protocol_http_py_lib-0.1.0b6-py3-none-any.whl.
File metadata
- Download URL: ds_protocol_http_py_lib-0.1.0b6-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1876358d28fb318aa018db41da7c926861bff0d891c5d9d5327a9d501f363eb0
|
|
| MD5 |
9b44a58537ae4dede6666b407e8a7ffa
|
|
| BLAKE2b-256 |
97663d670f0afd64d8c6532780246ef7a3573c62e6aaa24af2191328720374ed
|