zaius_export: export api for custom reporting
Using zaius_export, you can build and automate custom 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 zaius_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['zaius_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
Or This:
$ zaius-export email-metrics 9097 2019-4-25 2020-4-25
Replace '9097' with the campaign ID you want to view metrics for. Replace '2019-4-25 2020-4-25' with the timerange of your choice. This timerange reflects the times assigned to the 'Scheduled Campaign Run Time' field of email send events. For each of the send events that meet that time range, any and all opens, clicks, and spamreports are counted if they happened, irregardless of when they happened. This timerange also serves as the lower and upper bounds in which unsubscribe events happened.
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.
Metadata
Release files for zaius-export 1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zaius_export-1.5.tar.gz | 13.6 kB | Without provenance | Details for zaius_export-1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zaius_export-1.5-py3-none-any.whl | Python 3 | none | any | Details for zaius_export-1.5-py3-none-any.whl |
Total release size: 32.4 kB
Release files / zaius_export-1.5.tar.gz
| Download URL | zaius_export-1.5.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e00a4f0fa9bb85e4bae7f8cdb164df2fcd1e39a6549dc6e118feba1a8365f304
|
|
BLAKE2b-256 checksum How to use checksums |
2b15b0a98a44e221da29827adbb6df9b9d19cef3e0395cbdf6821e75b1a37e55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3
|
Release files / zaius_export-1.5-py3-none-any.whl
| Download URL | zaius_export-1.5-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a73fd8555afb81089cabebf535054474d8ca4531c54f0f5ab10046cf7f2a012
|
|
BLAKE2b-256 checksum How to use checksums |
6aa7821d099b8279814375c7c30faf7ba4179f68e3c4ee41093d5d2b83bc2d44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3
|
Security for zaius-export 1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.