Skip to main content

A requests addon for Pelican data federations

Project description

Python-requests interface for Pelican Platform

This project provides requests addons to support HTTP requests to a Pelican Federation.

The main component is a new PelicanAdapter class that handles translating Pelican URIs into HTTP URLs to enable standard GET requests, including looping over Pelican caches.

This project also provides wrappers around requests.get (and friends) and requests.Session to simplify configuring support for Pelican URIs.

Install

To install this project, use pip:

pip install requests-pelican

To include support for SciTokens include the [scitokens] extra:

pip install requests-pelican[scitokens]

Examples

1. Public data

import requests_pelican
print(requests_pelican.get("osdf:///gwdata/zenodo/README.zenodo").text)

2. Private data requiring token authorisation

Requests for data from a Private Pelican federation require a Bearer token. requests-pelican will attempt to automatically discover a valid SciToken before GETting the data.

import requests_pelican
print(requests_pelican.get("osdf:///igwn/ligo/README").text)

3. Integrating with other requests plugins

The requests_pelican.PelicanAdapter object can be integrated with the standard requests.Session to simplify combining Pelican support with other plugins, for example:

from requests_pelican import PelicanAdapter
from igwn_auth_utils import Session
with Session() as sess:
    sess.mount("osdf://", PelicanAdapter("osdf"))
    resp = sess.get("osdf:///igwn/ligo/README", token_scope="read:/ligo")
    ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requests_pelican-0.2.0.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

requests_pelican-0.2.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file requests_pelican-0.2.0.tar.gz.

File metadata

  • Download URL: requests_pelican-0.2.0.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for requests_pelican-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b1893cd78d0c8478555662bf3102ee722548cb4cae05945911775a2d0677e273
MD5 fe42fadd01568365813c41dad5cb750c
BLAKE2b-256 a867ff53679a8bfd2e6434d320c8847d9480c349b8ab3b5e3657d78a6c383db3

See more details on using hashes here.

File details

Details for the file requests_pelican-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for requests_pelican-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4f4aab8c9a6c1f6a72271ce5e78836161159e52f65b791746a83931c835f26c
MD5 a1fc87ea8317e4cf88b7e9f4cc048329
BLAKE2b-256 978d17e56f2208b885aa8462277ae75a9bc82f7877bb52d88690636246853032

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page