Skip to main content

Python SDK for VWO server-side A/B Testing

Project description

VWO Python SDK

PyPI version Build Status Coverage Status License

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

vwo-python-sdk-example

Third-party Resources and Credits

Refer third-party-attributions.txt

Authors

Changelog

Refer CHANGELOG.md

Contributing

Please go through our contributing guidelines

Code of Conduct

Code of Conduct

License

Apache License, Version 2.0

Copyright 2019-2021 Wingify Software Pvt. Ltd.

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

vwo-python-sdk-1.17.0.tar.gz (41.9 kB view details)

Uploaded Source

File details

Details for the file vwo-python-sdk-1.17.0.tar.gz.

File metadata

  • Download URL: vwo-python-sdk-1.17.0.tar.gz
  • Upload date:
  • Size: 41.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.10

File hashes

Hashes for vwo-python-sdk-1.17.0.tar.gz
Algorithm Hash digest
SHA256 727e4a5027a38a450ee39c767b0c63c905e5d30922c2602175af99ac0e52b2c1
MD5 225b07df533d5804a22d7aaa40441073
BLAKE2b-256 7d9855982fbf15c19ee5300bf6f8dfce2344a697001be7145aea3e6e1b0a8b32

See more details on using hashes here.

Supported by

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