This is a Python SDK used for in-house developments and our own tools. The source code is hosted on Github and released under the Apache 2.0 license, so feel free to collaborate to improve it!
This Python SDK supports Python 2 and 3, for versions 2.7+ and 3.4+ respectively. It is recommended that Python 2 users use python 2.7.9+ to take advantage of the SSL Certificate Validation feature that is not included in earlier versions. You can install the SDK Client Library with
$ sudo pip install apilityio-lib
Create the client object
The developer has to instance an object first passing as argument the API_KEY obtained after registering in Auth0 Signals.
It’s possible to use the Python SDK without an API key, but it will be restricted to only 100 hits per day. All users will get an API Key after signing up with 40000 daily hits available.
To instantiate the client class with an API key:
client = apilityio.Client(api_key=api_key)
To instantiate the client class without an API key:
client = apilityio.Client()
Execute API calls
Now it’s time to perform the API calls. For example to lookup an IP address in Auth0 Signals databases of IP Addresses blacklists:
response = client.CheckIP(ip)
If the IP address has been not found in any blacklist, it will return a 404 code in the status_code attribute of the Response object:
if response.status_code == 404: print("Congratulations! The IP address has not been found in any blacklist.")
If the IP address has been not in any blacklist, it will return a 200 code in the
status_code attribute of the Response object, and the lists of blacklists in the blacklists attribute:
if response.status_code == 200: print("Ooops! The IP address has been found in one or more blacklist") blacklists = response.blacklists print('+- Blacklists: %s' % blacklists)
Now the developer can perform as many requests as needed with this client object. And he/she doesn’t need to close the connection because it is stateless.
If you would like to obtain an example code for any of the included client libraries, you can find it on the examples folder.
Do you have an issue using the Python SDK? Or perhaps some feedback for how we can improve them? Feel free to let us know on the Github issue tracker.