Skip to main content

Python package to interact with multiple authentication services

Project description

py-multiauth PyPI CI CD codecov

PyPI - Python Version PyPI - Downloads

Installation

pip install py-multiauth

Supported methods

Name Authenticate Refresh Extra
API_KEY
AWS Signature
BASIC
REST
DIGEST
GRAPHQL
HAWK
MANUAL
OAUTH

Usage

Loading a configuration file

Currently, we support 4 way of loading a configuration file.

# Using constructor argument
MultiAuth(authrc_file='path.json')

# Using environment variable
os.environ['AUTHRC'] = 'path.json'

# Using autodection
os.paths.exists('.authrc')?

# Using autodection from user home directory
os.path.exists(os.path.expanduser('~/.multiauth/.authrc'))?

Managing authentication flow

MultiAuth supports context singleton. From that, you can instanciate MultiAuth and re-use the same class in another package as far it is sharing the same context.

auth = MultiAuth(auths=.., users=.., authrc=.., logger=..)

# Sending the requests to get the correct headers
auth.authenticate_users()

# Getting the header before sending a HTTP request
auth_headers = auth.reauthenticate(username=.., additional_headers=.., no_auth=..)
r = requests.get('https://example.com', headers=auth_headers[0])

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License PyPI - License

MIT

Project details


Release history Release notifications | RSS feed

This version

1.8.1

Download files

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

Source Distribution

py_multiauth-1.8.1.tar.gz (34.6 kB view details)

Uploaded Source

Built Distribution

py_multiauth-1.8.1-py3-none-any.whl (46.9 kB view details)

Uploaded Python 3

File details

Details for the file py_multiauth-1.8.1.tar.gz.

File metadata

  • Download URL: py_multiauth-1.8.1.tar.gz
  • Upload date:
  • Size: 34.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for py_multiauth-1.8.1.tar.gz
Algorithm Hash digest
SHA256 20578b84c97391007bf7ae4b5554bd72e853d7776d93fda7453e94370d2a315b
MD5 78c506611bc682146d500e122863b26e
BLAKE2b-256 9a9579ab581d9a193729a7b8084fd7701107ff69cba47a10bf95e846d0f7dd49

See more details on using hashes here.

File details

Details for the file py_multiauth-1.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for py_multiauth-1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f40569501cfccebb120ef04f8784f2f45a1541d597c9488f9c3f8cfcba79ee6f
MD5 2a1b8051f486590574bf5744e1d2505e
BLAKE2b-256 c00cd6e0913c071c8c6214954c2c9edc827ce9c76007835f2a83a67a2cbeb984

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page