The SwitchKeys Python client enables seamless integration with the SwitchKeys feature management platform in Python applications. Developers can effortlessly incorporate feature flags and toggle management into their projects, accessing user data, retrieving feature values, and setting feature flags with ease. This client streamlines the process of implementing feature management functionality, empowering developers to efficiently control feature rollout and experimentation in their applications.
Project description
SwitchKeys Python Client
The SwitchKeys Python Client provides a convenient way to interact with the SwitchKeys API using Python applications. This README provides an overview of the SwitchKeys Python Client, its installation process, usage instructions, and additional resources.
Table of Contents
Installation
To install the SwitchKeys Python Client, you can use pip, Python's package manager. Run the following command in your terminal:
pip install switchkeys
Usage
To use the SwitchKeys Python Client in your Python application, you need to import the necessary modules and initialize a SwitchKeys instance with your API token. If you don't have an API token yet, you can use the authentication methods provided by the client to obtain one and save it in a config.ini
file for future use.
Initializing SwitchKeys Instance
from switchkeys.core.base import SwitchKeys
# If you already have an API token
switch_key = SwitchKeys(api_token="YOUR_API_TOKEN_HERE")
# If you don't have an API token yet
# Use the auth.login method to obtain tokens and save them in the config.ini file
# Or use the auth.register method to create a new user and obtain tokens
# Then initialize the SwitchKeys instance with the obtained tokens
Authentication Methods
Logging In
user = switch_key.auth.login(email="your_email@example.com", password="your_password")
# Set the token on the switchkeys instance.
SWITCH_KEY_API_TOKEN = user.access_token
switch_key.api_token = SWITCH_KEY_API_TOKEN
Registering a New User
user = switch_key.auth.register(
email="new_user@example.com",
first_name="New",
last_name="User",
password="password123"
)
# Set the token on the switchkeys instance.
SWITCH_KEY_API_TOKEN = user.access_token
switch_key.api_token = SWITCH_KEY_API_TOKEN
After obtaining the tokens, they will be automatically saved in the config.ini
file for future use.
Examples
The SwitchKeys Python Client comes with several examples to demonstrate its usage for various functionalities, such as authentication, managing organizations, projects, users, etc. You can find these examples in the examples
directory of the repository.
To run the examples, navigate to the examples
directory and execute the Python scripts. For example:
cd examples
python auth_example.py
Documentation
For detailed documentation on how to use the SwitchKeys Python Client, including available methods, parameters, and usage examples, please refer to the official documentation.
For more detailed documentation and usage examples, please refer to the official documentation.
Contributing
Contributions to the SwitchKeys Python Client are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository.
Before contributing, please review the contribution guidelines.
License
The SwitchKeys Python Client is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for switchkeys-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc85d005303bece1ae59d0079dd104bce6e2850a7f354eb032f09c2324e98f37 |
|
MD5 | e1488779755178c6a2189bde6f318186 |
|
BLAKE2b-256 | ec77354319c75b82af367074a494d3ad1dfee958f321cffbd65b4bace7c8656c |