Skip to main content

A package for read and writing auth

Project description

Build Status Coverage Status

Basic

A package for creating and reading config files for basic authentication.

Purpose

A lot of APIs use basic authentication, this is where you concatenate username and password separated by a : and encode them with base64 then prefix with Basic. So username:password encoded with base64 becomes Basic dXNlcm5hbWU6cGFzc3dvcmQ=. This package manages the encoding and storing of this configuration so it can be easily retrieve and used.

Usage

Getting started is easy, first install the package using pip install basic

Next you can create your auth dict

form basic_auth import Auth
CONFIG = Auth().basic_config("url", Auth().encode("username", "password"))

Write it to file

Auth().create_config("basic_config.json", CONFIG)

To read it in your own scripts

CONFIG = Auth().read_config("basic_config.json")

Have a read of simple.py

There's some examples in the Examples directory general.py supports both interactive input and arguments.

python3 Examples/general.py -url example.com -username user1 -password hunter2

and

python3 Examples/general.py

WSO.py shows how to use it and insert your own custom fields too.

Details

This will create a folder called config and store the config in a json file with the following structure

{
    "url": "url",
    "authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ="
}

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

basic_auth-0.0.1.tar.gz (6.1 kB view hashes)

Uploaded source

Built Distribution

basic_auth-0.0.1-py3-none-any.whl (12.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page