Skip to main content

Official UserList SDK for Python

Project description

Userlist SDK for Python

The official Python client library to manipulate Userlist from your Python application.

Documentation is identical with the API documentation. The same parameters and filters are available. And the same response structure. You can have a look at Docs.

Authentication

The Authentication is done via the push_key variable.

Check your Push key at Userlist Settings.

Installation

pip install userlist

Quick Start

Import installed package.

from userlist_python import UserlistApiClient

Init the instance with an API key given after registration.

userlist_client = UserlistApiClient('YOUR_API_KEY')

Endpoints

An instance of UserlistApiClient has all main methods that correspond to endpoints available for UserList API.

Tracking user data (/users)

User data can be tracked by sending POST requests to https://push.userlist.com/users. The only required parameter is identifier which is a unique identifier for that user within your application. This can either be the user’s primary key in your database, a generated tracking identifier or their email address (we don’t recommend using email address though, because it’s less reliable). Whatever you choose, make please keep in mind that it’ll be the way Userlist identifies this user moving forward.

response = userlist_client.push_users(
    identifier="user_test",
    email='test@example.net',
    properties={"first_name": "Test2","last_name": "Testing2"}
)

Deleting users (/users/{{identifier}})

You can remove user data by sending a DELETE request to https://push.userlist.com/users/{{identifier}}. The identifier is the same one you sent when sending the user data initially. We’ll process your deletion request within a few of moments and remove the user, all their events, as well as all their messages. All campaigns will immediately be stopped. If you send any data or event with this property after requesting a deletion, we’ll treat it as fresh and create a new user.

response = userlist_client.delete_users(
    'user_test'
)

Tracking company data (/companies)

Company data can be tracked by sending POST requests to https://push.userlist.com/companies. The only required parameter is identifier which is a unique identifier for that company within your application. This can either be the company's primary key in your database, or some kind of generated tracking identifier. Whatever you choose, make please keep in mind that it’ll be the way Userlist identifies this company moving forward.

response = userlist_client.push_companies(
    identifier="company_test",
    name='Example, Inc.',
    properties={
    "industry": "Testing",
    "billing_plan": "enterprise"
  },
    relationships=[
    {
      "user": "user_test",
      "properties": {
        "role": "owner"
      }
    }
  ]
)

Deleting Companies (/companies/{{identifier}})

You can remove company data by sending a DELETE request to https://push.userlist.com/companies/{{identifier}}. The identifier is the same one you sent when sending the company data initially. We’ll process your deletion request within a few of moments and remove the company, all its events, as well as all relationships to users. The users that where part of that company are not deleted automatically. If you send any data or event with this company after requesting a deletion, we’ll treat it as fresh and create a new company record.

response = userlist_client.delete_companies(
    'company_test'
)

Tracking relationships (/relationships)

Userlist allows you to track relationships between users and companies. It's possible to track many-to-many relationships between users and companies. Creating a relationship needs at least two pieces of information: a user and a company.

response = userlist_client.push_relationships(
    user="user_test",
    company='company_test',
    properties={
    "role": "admin"
  }
)

Deleting relationships (/relationships/{{user-identifier}}/{{company-identifier}})

You can remove a relationship data by sending a DELETE request to https://push.userlist.com/relationships/{{user-identifier}}/{{company-identifier}}. We’ll process your deletion request within a few of moments and remove the relationship between this user and this company. Both the associated user and company are not deleted automatically.

response = userlist_client.delete_relationships(
    'user_test',
    'company_test'
)

Tracking events (/events)

Similar to tracking user or company data, tracking events works by sending POST requests to https://push.userlist.com/events. Tracking an event requires at least two pieces of information: a name, and a user or company identifier. Other parameters are optional.

response = userlist_client.push_events(
    name="product_purchased",
    company='company_test',
    properties={
    "product": "Flowers",
    "price": "$12.99"
  }
)

Feedback

Feel free to contact us if you have spot a bug or have any suggestion at benedikt[at]benediktdeicke.com

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

userlist-python-0.2.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

userlist_python-0.2.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file userlist-python-0.2.0.tar.gz.

File metadata

  • Download URL: userlist-python-0.2.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.9 Darwin/21.3.0

File hashes

Hashes for userlist-python-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cf4b33d2b11d896324f289b11f8654a68a8b8f6d67685639dd6caccb0f9d70eb
MD5 f10dbc8a421a1bf270114d8879e4a542
BLAKE2b-256 fe689b4aec5a73a1076d8c9f798ab46368174ec2f1eb81d1618c5f8249fc94c3

See more details on using hashes here.

File details

Details for the file userlist_python-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: userlist_python-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.9 Darwin/21.3.0

File hashes

Hashes for userlist_python-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afbe878639f2f0923f379b957c4dd4937e252fb7902c060a60121a3cd991f02a
MD5 0a4745f19325d886493fc2d64924a172
BLAKE2b-256 dfa5acf3456258ca60874292aad47e22fdf37125a51cdd6bef9fed5ceed735ae

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