A convenience library to make retrieving data from the Activity Stream Data Service API easier
Project description
activitystreampython
A Python 3 module for interacting with the Activity Stream Data Service API v1.
To find out more about the Activity Stream Data Service API, browse the Swagger documentation.
Usage
Installation
pip install activitystreampython
Sample usage
from activitystreampython import ActivityStreamAPI
from datetime import datetime, timezone, timedelta
tenant = "demo" # Your Activity Stream tenant (this will be the same as the Activity Stream subdomain)
username = "example@example.com" # The email address for your API user
password = "correct-horse-battery-staple" # The password for your API user - NB: don't store passwords in code!
end_datetime = datetime.now(timezone.utc)
start_datetime = end_datetime - timedelta(days=7)
activity_stream = ActivityStreamAPI(tenant=tenant, username=username, password=password)
# Retrieve customers
# This method initialises a generator which can be iterated over to retrieve customer data
customers = activity_stream.ticketing_data(
data_type="customers",
start_datetime=start_datetime,
end_datetime=end_datetime,
filter_type="updatedate",
)
for customer in customers:
print(customer)
# Retrieve tickets
# This method initialises a generator which can be iterated over to retrieve ticket data
tickets = activity_stream.ticketing_data(
data_type="tickets",
start_datetime=start_datetime,
end_datetime=end_datetime,
filter_type="updatedate",
)
for ticket in tickets:
print(ticket)
# Retrieve marketing permissions
# This method initialises a generator which can be iterated over to retrieve marketing permission data
marketing_permissions = activity_stream.marketing_data(start_datetime=start_datetime)
for marketing_permission in marketing_permissions:
print(marketing_permission)
Notes
We recommend using the updatedate
filter_type
if you are using this package to keep an external
database up-to-date with Activity Stream data. That way you can be sure that you will never miss out
on data even if historic records are backfilled in Activity Stream. For the initial import, using the
eventdate
filter_type
may be more predictable in terms of data volumes for each time period.
This package is not officially supported, although we do use it internally and will endeavour to avoid breaking changes.
License
Copyright 2023 crowdEngage Limited
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file activitystreampython-0.1.11.tar.gz
.
File metadata
- Download URL: activitystreampython-0.1.11.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.1 CPython/3.11.2 Darwin/22.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00eb082e9eac21b3215d6e3ae0092618b9680cda18e09320ddaed267f5c938c0 |
|
MD5 | 7eddfd5b2e93fca7300c80c858a593a0 |
|
BLAKE2b-256 | 5b97785b2d013f58c1774fb6b803a05ea7f60a744e7029c22fca0152094d307f |
File details
Details for the file activitystreampython-0.1.11-py3-none-any.whl
.
File metadata
- Download URL: activitystreampython-0.1.11-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.1 CPython/3.11.2 Darwin/22.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e19d0a07fc701f288a865197e900269dfcd154f58cc12232a8d8cb322968c5c |
|
MD5 | cf1e4dd2bd5913fba3ebcfb5e2e57fcd |
|
BLAKE2b-256 | 7186644e3c317d8b3ed3cebfc8da2ef0ea14e959d17f20fba7a8fe0be562f71b |