Python SDK for VWO server-side A/B Testing
Project description
VWO Python SDK
This open source library allows you to A/B Test your Website at server-side.
Requirements
- Works with Python: 2.7 onwards. Python 3 is also supported.
Installation
It's recommended you use virtualenv to create isolated Python environments.
pip install vwo-python-sdk
Basic usage
Importing and Instantiation
import vwo
settings_file = vwo.get_settings_file(account_id, sdk_key)
vwo_client_instance = vwo.launch(settings_file)
API usage
# activate API
variation_name = vwo_client_instance.activate(ab_campaign_key, user_id)
# get_variation_name API
variation_name = vwo_client_instance.get_variation_name(ab_campaign_key, user_id)
# track API
vwo_client_instance.track(ab_campaign_key, user_id, ab_campaign_goal_identifeir, revenue_value)
Log Level - pass log_level to SDK
import vwo
from vwo import LogLevels
settings_file = vwo.get_settings_file(account_id, sdk_key)
vwo_client_instance = vwo.launch(settings_file, log_level=LogLevels.DEBUG)
Custom Logger - implement your own logger method
import vwo
class CustomLogger:
def log(self, level, message):
print(level, message)
# ...write to file or database or integrate with any third-party service
settings_file = vwo.get_settings_file(account_id, sdk_key)
vwo_client_instance = vwo.launch(settings_file, logger = CustomLogger())
User Storage Service
import vwo
from vwo import logger
class user_storage(UserStorage):
def get(self, user_id, campaign_key):
# ...code here for getting data
# return data
def set(self, user_storage_data):
# ...code to persist data
us = user_storage()
settings_file = vwo.get_settings_file(account_id, sdk_key)
vwo_client_instance = vwo.launch(settings_file, user_storage = us)
Documentation
Refer Official VWO Documentation
Local development
python setup.py develop
Running Unit Tests
python setup.py test
Demo Python application
Third-party Resources and Credits
Refer third-party-attributions.txt
Authors
- Main Contributor - Shravan Chaudhary
- Repo health maintainer - Varun Malhotra(@s0ftvar)
Changelog
Refer CHANGELOG.md
Contributing
Please go through our contributing guidelines
Code of Conduct
License
Copyright 2019-2022 Wingify Software Pvt. Ltd.
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
vwo-python-sdk-1.36.0.tar.gz
(51.8 kB
view details)
File details
Details for the file vwo-python-sdk-1.36.0.tar.gz
.
File metadata
- Download URL: vwo-python-sdk-1.36.0.tar.gz
- Upload date:
- Size: 51.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2818e662cee43e058e5052a89e410508a6aefbcbd80c1cec67268322ecd9271a |
|
MD5 | 1af039eb0404c7ecb76135b4663b9868 |
|
BLAKE2b-256 | ca89f683f5d76e60ecd87175bc4e78da3db0175f9cbbfd17761e9beb68d61375 |