This is the official Python SDK for journy.io.
You can use the python package manager (pip
) to install the SDK:
pip install journyio-sdk
To start, first import the client.
from journyio.client import Client, Config
To be able to use the journy.io SDK you need to generate an API key. If you don't have one you can create one in journy.io.
If you don't have an account yet, you can create one in journy.io or request a demo first.
Go to your settings, under the Connections-tab, to create and edit API keys. Make sure to give the correct permissions to the API Key.
from journyio.httpclient import HttpClientRequests
config = Config("api-key-secret")
http_client = HttpClientRequests() # If wanted, an own implementation of the HttpClient interface can be created
client = Client(http_client, config)
from journyio.results import Success
result = client.get_api_key_details()
if isinstance(result, Success):
print(result.request_id) # str
print(result.calls_remaining) # int
print(result.data) # ApiKeyDetails
print(result.permissions) # list of strings denoting the permissions
Every call will return a Success
or Failure
object. Success
objects refer to the call having succeeded (and
optionally containing data). A Failure
object refers to the API returning an error. This can be any APIError
(too
many requests, not found...). Our SDK only throws JournyExceptions
, no other exceptions should be
called. JournyExceptions
are provided with useful messages, which state where the error was made.
from journyio.utils import JournyException
try:
result = client.get_tracking_snippet("www.journy.io")
if isinstance(result, Success):
print(result.request_id) # str
print(result.calls_remaining) # int
print(result.data) # TrackingSnippetResonse
else:
print(result.request_id) # str
print(result.calls_remaining) # int
print(result.error) # APIError
except JournyException as e:
print(e.msg) # str with error message
The request ID can be useful when viewing API logs in journy.io.
To run the tests:
cd tests
pip install -r requirements.txt
pip install -U pytest
python scripts/createversion.py 0.0.0
pytest
We welcome your feedback, ideas and suggestions. We really want to make your life easier, so if weβre falling short or should be doing something different, we want to hear about it.
Please create an issue or contact us via the chat on our website.
If you discover any security related issues, please email security at journy io instead of using the issue tracker.