Git Product home page Git Product logo

vero-python's Introduction

vero: Python client for Vero

Full documentation can be found on ReadTheDocs

Vero is an API wrapper for event logging in your Python application. Fetch your auth token from your Vero account and use the python interface instead of API web hooks. :

>>> from vero import VeroEventLogger
>>> logger = VeroEventLogger(auth_token)
>>> user_id = 42
>>> user_data = {
        'full_name': 'Jane Doe'
    }
>>> response = logger.add_user(user_id, user_data)
>>> response.status_code
200

Features

Modify user data and log events. Run in live or test mode.

  • Add user
  • Edit user
  • Add user tags
  • Remove user tags
  • Unsubscribe user
  • Add event

Installation

Install the package from PyPI :

pip install vero

Usage

Create instance

Use the authorization token from your Vero account page to create a VeroEventLogger object. :

>>> from vero import VeroEventLogger
>>> auth_token = "foobar"
>>> logger = VeroEventLogger(auth_token)

After creating an instance of VeroEventLogger as logger use any of the following methods to access Vero. All methods will accept the keyword argument development_mode=True to enable logging in test mode.

Add user

Create a new user with the information in user_data. user_email is optional but is needed to trigger emails to the user. :

>>> user_id = 1
>>> user_email = '[email protected]'
>>> user_data = {
        'first name': 'John',
        'last name': 'Doe'
    }
>>> logger.add_user(user_id, user_data, user_email=user_email)

Edit user

Add or change fields in user_data for the user. :

>>> user_id = 1
>>> user_data = {
        'first name': 'Jane'
    }
>>> logger.edit_user(user_id, user_data)

Add user tags

Add each tag in tag_list to the user. :

>>> user_id = 1
>>> tag_list = ['blue', 'red', 'yellow']
>>> logger.add_tags(user_id, tag_list)

Remove user tags

Remove each tag in tag_list from the user. :

>>> user_id = 1
>>> tag_list = ['yellow']
>>> logger.remove_tags(user_id, tag_list)

Unsubscribe user

Unsubscribe the user from triggering future events. :

>>> user_id = 1
>>> logger.unsubscribe_user(user_id)

Add event

Note: adding an event with a user id that doesn't exist will create the user.

Event data can contain whatever fields are needed. :

>>> user_id = 2
>>> user_email = '[email protected]'
>>> event_name = 'Visited Website'
>>> event_data = {
        'date': 'today',
        'visited': 'front page'
    }
>>> logger.add_event(event_name, event_data, user_id, user_email=user_email)

Bitdeli badge

vero-python's People

Contributors

ryanwilsonperkin avatar nickpresta avatar damienbrz avatar mwarkentin 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.