Skip to content

HTTP

obstore.store.HTTPStore

Configure a connection to a generic HTTP server

Example

Accessing the number of stars for a repo:

import json

import obstore as obs
from obstore.store import HTTPStore

store = HTTPStore.from_url("https://api.github.com")
resp = obs.get(store, "repos/developmentseed/obstore")
data = json.loads(resp.bytes())
print(data["stargazers_count"])

client_options property

client_options: ClientConfig | None

Get the store's client configuration.

retry_config property

retry_config: RetryConfig | None

Get the store's retry configuration.

url property

url: str

Get the base url of this store.

__init__

__init__(
    url: str,
    *,
    client_options: ClientConfig | None = None,
    retry_config: RetryConfig | None = None,
) -> None

Construct a new HTTPStore from a URL

Parameters:

  • url (str) –

    The base URL to use for the store.

Other Parameters:

  • client_options (ClientConfig | None) –

    HTTP Client options. Defaults to None.

  • retry_config (RetryConfig | None) –

    Retry configuration. Defaults to None.

Returns:

  • None

    HTTPStore

from_url classmethod

from_url(
    url: str,
    *,
    client_options: ClientConfig | None = None,
    retry_config: RetryConfig | None = None,
) -> HTTPStore

Construct a new HTTPStore from a URL

This is an alias of HTTPStore.__init__.