Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Zaius Export API Interface

Project description

zaius_export: export api for custom reporting

Using zaius_export, you can build and automate aweseome reports. Like this:

import datetime
import zaius.export as export

# count the users who clicked this week
last_week = datetime.date.today() - datetime.timedelta(days=7)
last_week = datetime.datetime.fromordinal(last_week.toordinal()).replace(tzinfo=datetime.timezone.utc)

query = """
select user_id
from events
where
  event_type = 'email'
  and action = 'click'
  and ts > {}
""".format(int(last_week.timestamp()))
rows = export.API().query(query)
print(len(set([r['user_id'] for r in rows])))

Or, use pre-baked reports. Like this:

$ zaius-export product-attribution 2019-1-1 2019-1-31

Or This:

$ zaius-export lifecycle-progress 2018-1 2019-1

You can specify the output file. This example creates an export.csv file in the Documents directory:

$ zaius-export --output ~/Documents/export.csv product-attribution 2019-1-1 2019-1-31

Installation

Installation happens in the usual way:

$ pip install zaius_export

Now the zaius-export utility should be on your PATH.

Authorization

API calls depend on having a set of credentials available to authenticate your request. By default, all tools will look for these to be defined in $HOME/.zaius_api. This file should look like this:

[auth]
aws_access_key_id: ***
aws_secret_access_key: ***
zaius_secret_key: ***

You can find the appropriate values for this file by logging into Zaius. Click the gear icon next to your business name at the top left of the screen, select "APIs" from the menu on the left (under Data Management), and then find your zaius_secret_key under the Private tab.

Your AWS credentials can be found in the Integrations section (Gear Icon, Data Management, Integrations) by opening the AWS integration.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

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

Files for zaius-export, version 1.4.1
Filename, size File type Python version Upload date Hashes
Filename, size zaius_export-1.4.1-py3-none-any.whl (16.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size zaius_export-1.4.1.tar.gz (11.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page