Skip to main content

Geddit

Simple zero-configuration retrieval of resources by URL.

This module provides a single geddit function which takes a single parameter specifying the URL to fetch. It will return a bytes object with the contents of the resource at that URL or will raise an exception specific to the URL scheme.

This library is intended to be used in situations where scheme-specific configuration can be inferred from the environment. (For example, in Google Cloud-hosted environments there is usually a default identity which the services run as. This identity will be used to fetch resources specified via the gs or sm schemes.)

This library is not intended to replace general use libraries such as requests.

Examples

from geddit import geddit

# The default scheme is file://
geddit('file:///etc/issue')     # == b'Debian GNU/Linux 10 \\n \\l\n\n'
geddit('/etc/issue')            # == b'Debian GNU/Linux 10 \\n \\l\n\n'
geddit('./README.md')           # Raises: ValueError

# Fetching using HTTP over TLS
geddit('https://www.gov.uk/bank-holidays.json')[:20]  # == b'{"england-and-wales"'

# HTTP errors are reported
geddit('https://www.example.com/not-found')  # raises requests.exceptions.HTTPError

# Google Storage objects. Uses default application credentials.
geddit('gs://my-bucket/some-object')          # fetches latest generation
geddit('gs://my-bucket/some-object#abcdefg')  # fetches generation abcdefg

# Google Secret Manager secrets. Uses default application credentials.
geddit('sm://my-project/some-secret')       # fetches latest version
geddit('sm://my-project/some-secret#3')     # fetches version 3

# Data URLs.
geddit('data:application/x-yaml;charset=utf-8;base64,eyJmb28iOjF9')  # == b'{"foo":1}'

Requirements

  • Python >= 3.11.

Installation

The latest release of this library on PyPI can be installed using pip:

$ pip3 install geddit

The library can also be installed directly from the git repository if you want the most up-to-date version.

$ pip3 install git+https://gitlab.developers.cam.ac.uk/uis/devops/lib/geddit.git

For developers, the tool can be installed from a cloned repo using pip:

$ cd /path/to/this/repo
$ pip3 install -e .

Publishing a new release

See the guidebook section on publishing to PyPI for more information.

License

This software is licensed under an MIT-like software license. See the LICENSE file for the full text of the license.

Scheme-specific notes

file

The file scheme is the default scheme. Only absolute paths can be specified.

https

There is no support for HTTP basic authentication as that involves putting the cleartext password into the URL.

Non-TLS ("http") URLs are not supported.

gs and sm

Only default application credentials are supported. To use specific credentials, set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the absolute path to some JSON-formatted credentials.

data

Data URLs are not good way of passing secrets since their values are transparent. They can be useful for transferring non-secret configuration or for use in development environments.

Metadata

Release files for geddit 2.2.11

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

Source distribution (sdist)

Source distribution for geddit 2.2.11
File Size Uploaded Provenance
geddit-2.2.11.tar.gz 4.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for geddit 2.2.11
File Interpreter ABI Platform
geddit-2.2.11-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / geddit-2.2.11.tar.gz

Download URL geddit-2.2.11.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bd8ff737961d862d5e3c4b3e942eef050f0cb22e48d936875fc3625270aaf1aa
BLAKE2b-256 checksum
How to use checksums
1c006fafaa82eb8fdebe81c723a74930e85a63219ac4b783670a6fe23d4f2809
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / geddit-2.2.11-py3-none-any.whl

Download URL geddit-2.2.11-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1e9f793b4ee84a4905c8ec40f2b077337e0e8a009b431fcc0d155fea1a1ef52
BLAKE2b-256 checksum
How to use checksums
0f87537dbf2d1bb1e5d1ceee48cbdf7fb02d59366ad090ec7dcb155eb26aa221
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for geddit 2.2.11

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.

Release history Release notifications | RSS feed

This release

2.2.11 This release

2 release files No provenance

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