Skip to main content

evirons-serviceurl: Add service URL parsing support for environs

Travis-CI

environs-serviceurl is a Python library that extends the environs library with support for turning service urls like postgres://user:pass@host:port/database into Python dictionaries.

Install

$ pip install environs-serviceurl

Usage

# export DATABASE_URL=postgres://me:sekrit@postgres.example.com:5432/catpics
# export REDIS_URL=redis://redis.example.com?dbid=3

from environs import Env
from environs_serviceurl import service_url

env = Env()
env.add_parser('service_url', service_url)

# Parse a service url.
postgres_config = env.service_url('DATABASE_URL')
# {'host': 'postgres.example.com',
#  'port': 5432,
#  'user': 'me',
#  'password': 'sekrit',
#  'extras': 'catpics'}

# Give the extras a specific name
postgres_config = env.service_url('DATABASE_URL', extras_name='database')
# {'host': 'postgres.example.com',
#  'port': 5432,
#  'user': 'me',
#  'password': 'sekrit',
#  'database': 'catpics'}

# Parse a service url with defaults, using query params for extra values.
redis_config = env.service_url('REDIS_URL', 'redis://localhost/', defaults={
    'host': 'service.example.com', 'port': 6379, 'dbid': 0})
# {'host': 'redis.example.com',
#  'port': 6379,
#  'user': None,
#  'password': None,
#  'extras': None,
#  'dbid': '3'}

Limitations

There’s currently no way to do casting on any extras or query string paramaters. They will always be returned as string types.

License

MIT. See the LICENSE file for details.

Metadata

Release files for environs-serviceurl 1.0.1

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

Source distribution (sdist)

Source distribution for environs-serviceurl 1.0.1
File Size Uploaded Provenance Actions
environs-serviceurl-1.0.1.tar.gz 4.7 kB Without provenance Details for environs-serviceurl-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for environs-serviceurl 1.0.1
File Interpreter ABI Platform Actions
environs_serviceurl-1.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for environs_serviceurl-1.0.1-py2.py3-none-any.whl

Total release size: 9.6 kB

Release files / environs-serviceurl-1.0.1.tar.gz

Download URL environs-serviceurl-1.0.1.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e324784ae9932d17bdd58a032e04dce8e891fad3ebca1f9d43110dcee76bb5cb
BLAKE2b-256 checksum
How to use checksums
a7287c8be86279abb7c0a3d6372916879ccecac88da1c1b018838aa67ed83a36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / environs_serviceurl-1.0.1-py2.py3-none-any.whl

Download URL environs_serviceurl-1.0.1-py2.py3-none-any.whl
Size 4.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
840849a6b3557c880c5dcbeee77010a1425e2a5fcc5eb1fe09e924f4a2d9f419
BLAKE2b-256 checksum
How to use checksums
e9ddcd034dbfb594c7ba57f6339aa6b7ecf64108b9031d0bb016bae64b2020f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for environs-serviceurl 1.0.1

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

1.0.1 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