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"])

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

Note

Note that in contrast to the other stores, from_url will use the full URL provided here as a prefix for further operations.

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: