Skip to main content

No project description provided

Project description

Userwatch Python Client

The Userwatch Python library can be used identify users before they login or if they visit from multiple devices.

The Python library runs on your server and can be paired with the web or mobile to protect logins or payments.

Get your API Keys

Sign up for our beta at userwat.ch/beta to get your Private API key.

Getting started

Import the package and create a client with your api key.

from userwatch import userwatch

privateApiKey = "ADD_PRIVATE_API_KEY_HERE";
userwatchClient = userwatch.Userwatch(privateApiKey)

Validate a User

To validate a user you need a token from the javascript library. See the Userwatch Javascript Client Guide for how to get the token.

You also need a userId and possibly their email address or phone number, whichever is available to improve detection. You can use an email address as the id if you don't have another id.

from userwatch import userwatch
from userwatch import userwatch_public_pb2

userwatchToken = "GET FROM THE WEB CLIENT";

userInfo = userwatch_public_pb2.UserInfo(
    user_id="u_1234", // provide your user id if you have it.
    user_name="foo", // provide user name if you have it.
    user_email="foo@bar.com" // provide the email address if you have it.
    user_phone="+6100000000", // provide the phone number if you have it
)

eventType = userwatch_public_pb2.EVENT_TYPE_LOGIN

validateResponse = userwatchClient.validate(
  userwatchToken,
  userInfo,
  eventType
)

flagTypes = list(map(lambda f: f.type, resp.flags))
isAccountSharing = userwatch_public_pb2.FLAG_TYPE_ACCOUNT_SHARING in flagTypes
isRepeatedTrial = userwatch_public_pb2.FLAG_TYPE_REPEATED_SIGNUP in flagTypes

if isAccountSharing:
    print("user is account sharing")

if isRepeatedTrial:
    print("user is repeating trial")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

userwatch_python-0.0.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file userwatch_python-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for userwatch_python-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c1086c5fd51ffddac48a4288b71b600db2a50769b60cdbfaf8ce042fc60a50b2
MD5 09926b77a1cf0bdd6cf7faeb5086a09d
BLAKE2b-256 7d4cc999b85c71719266aad6cedfeaea74d8f22507899e312d49d30057cef353

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