Skip to main content

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

Metadata

Release files for ds-protocol-http-py-lib 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ds-protocol-http-py-lib 0.1.0
File Size Uploaded Provenance Actions
ds_protocol_http_py_lib-0.1.0.tar.gz 36.8 kB Without provenance Details for ds_protocol_http_py_lib-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ds-protocol-http-py-lib 0.1.0
File Interpreter ABI Platform Actions
ds_protocol_http_py_lib-0.1.0-py3-none-any.whl Python 3 none any Details for ds_protocol_http_py_lib-0.1.0-py3-none-any.whl

Total release size: 85.5 kB

Release files / ds_protocol_http_py_lib-0.1.0.tar.gz

Download URL ds_protocol_http_py_lib-0.1.0.tar.gz
Size 36.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5fec9b30d01e847ed18fcb978c7891b61fe0a70629215cfebcc8b32e9edf622f
BLAKE2b-256 checksum
How to use checksums
6c5e1ac25fba0cf1adf7a5bff23b8518fccd2bff4263df03ea7c3d97823da723
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ds_protocol_http_py_lib-0.1.0-py3-none-any.whl

Download URL ds_protocol_http_py_lib-0.1.0-py3-none-any.whl
Size 48.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b746d6bec62b09feab0cb5ec4553188f3343c2c9558898aff4c29122cb44c43e
BLAKE2b-256 checksum
How to use checksums
e6cb681cd4144c1aa1ddbc1e7a84f2873f2a7299e4e303a864761a3faec15f3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ds-protocol-http-py-lib 0.1.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page