GithubHelp home page GithubHelp logo

mida-so / mida-python Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 7 KB

Mida server-side A/B Testing and Feature Flagging for Python. Start for free up to 50,000 MTU.

Home Page: https://mida.so

License: MIT License

Python 100.00%
ab-testing abtest experiment feature-flags split-testing conversion-rate-optimization website-optimization

mida-python's Introduction

Mida Python Client

This repository contains a Python client for interacting with the Mida.so.

Installation

Clone the repository:

git clone https://github.com/mida-so/mida-python.git

Install the required dependencies:

pip install requests

Usage

Import the Mida class to your Python project. Create an instance of Mida using the project key from your Mida.so account. Use the available methods to interact with the Mida API. Example usage:

from mida import Mida
# replace 'your-project-key' with your actual key
mida_instance = Mida('your-project-key')
# replace 'your-experiment-key' and 'your-distinct-id' with actual values
experiment = mida_instance.get_experiment('your-experiment-key', 'your-distinct-id')
if experiment == 'Control':
    print('Control variant execute')
elif experiment == 'Variant 1':
    print('Variant 1 variant execute')
elif experiment == 'Variant 2':
    print('Variant 2 variant execute')
# set an event
mida_instance.set_event('event_name', 'your-distinct-id')

# reload feature flags for a user
mida_instance.on_feature_flags('your-distinct-id')

# check if a feature flag is enabled
is_enabled = mida_instance.is_feature_enabled('feature_flag_key')
if is_enabled:
    print('Feature flag is enabled')
else:
    print('Feature flag is disabled')

# set user attributes
attributes = {
    'name': 'John Doe',
    'email': '[email protected]'
}
mida_instance.set_attribute('your-distinct-id', attributes)

Methods

  • get_experiment(experiment_key, distinct_id): Retrieves the assigned variant for the specified experiment and user.
  • set_event(event_name, distinct_id): Sets an event for the specified user.
  • is_feature_enabled(key): Checks if a specific feature flag is enabled for the current user.
  • on_feature_flags(distinct_id): Reloads the feature flags for the specified user.
  • set_attribute(distinct_id, properties): Sets user attributes for the specified user with the given properties.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvement, please create a pull request.

Support

For support, please contact us at [email protected].

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

mida-python's People

Contributors

donaldng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.