Skip to main content

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


Download files

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

Source Distribution

switchkeys-0.1.2.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

switchkeys-0.1.2-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file switchkeys-0.1.2.tar.gz.

File metadata

  • Download URL: switchkeys-0.1.2.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-26-generic

File hashes

Hashes for switchkeys-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3ebeb7d9aba8038569e670532e797360b4951292c2ecdd82cee2fa2878110b9a
MD5 2a9ae680f51a5d9d3b0b81a8a026c1c6
BLAKE2b-256 4c7a82ca900b12ae48b44fc4a2afbcb73a1d03a75ef2c60d41fffa05d561abb7

See more details on using hashes here.

File details

Details for the file switchkeys-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: switchkeys-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-26-generic

File hashes

Hashes for switchkeys-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cc85d005303bece1ae59d0079dd104bce6e2850a7f354eb032f09c2324e98f37
MD5 e1488779755178c6a2189bde6f318186
BLAKE2b-256 ec77354319c75b82af367074a494d3ad1dfee958f321cffbd65b4bace7c8656c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page