This is the module responsible for the client-side connection configuration.
# The easy way
pip install backupchan-client-config
# Installing from source
git clone https://github.com/Backupchan/client-config.git backupchan-client-config
cd backupchan-client-config
pip install .from backupchan_config import *
# Uses the default config path if no argument is passed.
# Use Config("/path/to/config.json") to use a custom config path.
config = Config()
try:
config.read_config()
except ConfigException:
config.reset()
# Write a new config.
config.host = "http://127.0.0.1"
config.port = 5000
config.api_key = "bakch-123456etc"
config.save_config()
# Use it to connect to the API.
form backupchan import API
api = API(config.host, config.port, config.api_key)
print(api.list_targets())