| Name | amplitude-data-wrapper JSON |
| Version |
0.5.8
JSON |
| download |
| home_page | None |
| Summary | python wrapper for using the amplitude analytics and taxonomy APIs |
| upload_time | 2025-10-17 10:40:06 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.10 |
| license | None |
| keywords |
amplitude
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Amplitude data wrapper
[](https://github.com/astral-sh/ruff)
This is a wrapper for [Amplitude](https://amplitude.com/) APIs. You can use it to query and export data from your account and use the taxonomy API.
Built with [requests](https://requests.readthedocs.io/en/latest/) and [tqdm](https://github.com/tqdm/tqdm)
**Why use this package instead of other wrappers?**
This package supports regions and so you can use it with Amplitude accounts in the EU and USA.
This package also supports using a proxy so you can keep your project API keys and API secrets confidential.
## Supported Amplitude APIs and docs
- [Amplitude data wrapper](#amplitude-data-wrapper)
- [Supported Amplitude APIs and docs](#supported-amplitude-apis-and-docs)
- [Dashboard Rest API](#dashboard-rest-api)
- [Privacy API](#privacy-api)
- [Cohort API](#cohort-api)
- [Export API](#export-api)
- [Taxonomy API](#taxonomy-api)
See examples below and in [example.py](example.py)
Install with
```bash
pip install amplitude-data-wrapper
```
or
```bash
uv add amplitude-data-wrapper
```
### Dashboard Rest API
[Results from an existing chart](https://developers.amplitude.com/docs/dashboard-rest-api#results-from-an-existing-chart)
Get data from EU account by setting `region=1`.
```python
import amplitude_data_wrapper.analytics_api as amp
# without proxy
r = amp.get_chart(
api_key=api_key, secret=api_secret, chart_id=chart_id_eu, region=1
) # region 1 is EU
r.status_code
r.json() # returns data as json
```
Get data from US account by setting `region=2`.
```python
r = amp.get_chart(
api_key=api_key, secret=api_secret, chart_id=chart_id_eu, region=2
) # region 2 is USA
r.json() # returns data as json
```
Get data from EU account with a proxy by setting region and proxy using a dictionary.
```python
# with proxy
proxies = {"http": "http://myproxy.example.org/method"}
r = amp.get_chart(api_key, api_secret, chart_id_eu, region=1, proxy=proxies)
r.status_code # print status code
```
[Event segmentation](https://developers.amplitude.com/docs/dashboard-rest-api#event-segmentation) lets you export events with segments and filters.
```python
our_event_dict = {
"event_type": "pageview",
"group_by": [{"type": "event", "value": "app"}, {"type": "event", "value": "team"}],
}
data = amp.get_event_segmentation(
api_key=api_key,
secret=api_secret,
start="20220601",
end="20220602",
event=our_event_dict,
metrics="uniques",
interval=1,
limit=1000,
)
```
[User search](https://developers.amplitude.com/docs/dashboard-rest-api#user-search) lets you search for a user with a specific Amplitude ID, Device ID, User ID, or User ID prefix.
```python
user = amp.find_user(
user=example_id_eu,
api_key=api_key,
secret=api_secret,
region=1)
```
### Privacy API
Delete user data with a [deletion job](https://developers.amplitude.com/docs/user-deletion#deletion-job)
```python
deleteme = amp.delete_user_data(
user["matches"][0]["amplitude_id"],
email=email,
api_key=api_key,
secret=api_secret,
region=1,
ignore_invalid_id=True,
delete_from_org=False,
)
```
[Get a list of deletion jobs](https://developers.amplitude.com/docs/user-deletion#get)
```python
tobe_deleted = amp.get_deletion_jobs(
start="2022-06-01",
end="2022-07-01",
api_key=api_key,
secret=api_secret,
region=1,
)
```
### Cohort API
[Getting one cohort](https://developers.amplitude.com/docs/behavioral-cohorts-api#getting-one-cohort)
```python
proxies = {"http": "http://myproxy.domain.org/path"}
file_path = "path-to/cohortdata.csv"
kull = amp.get_cohort(
api_key,
api_secret,
cohort_id,
filename=file_path,
props=1,
region=1,
proxy=proxies,
)
```
### Export API
[Export API - Export your project's event data](https://developers.amplitude.com/docs/export-api#export-api---export-your-projects-event-data)
```python
start = "20220601T00"
end = "20220601T01"
data = amp.export_project_data(
start=start,
end=end,
api_key=api_key,
secret=api_secret,
filename="path-to/projectdata_eu.zip",
region=1,
)
```
### Taxonomy API
[Get all event types](https://developers.amplitude.com/docs/taxonomy-api#get-all-event-types)
```python
types = amp.get_all_event_types(
api_key=api_key,
secret=api_secret,
region=1)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "amplitude-data-wrapper",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "amplitude",
"author": null,
"author_email": "Tobias McVey <tobias.mcvey@nav.no>",
"download_url": "https://files.pythonhosted.org/packages/0e/32/3cd4ec19e19833935cad17ffa7b64d7a582e0a94bc85c6668dc72611f7dc/amplitude_data_wrapper-0.5.8.tar.gz",
"platform": null,
"description": "# Amplitude data wrapper\n\n[](https://github.com/astral-sh/ruff)\n\nThis is a wrapper for [Amplitude](https://amplitude.com/) APIs. You can use it to query and export data from your account and use the taxonomy API.\n\nBuilt with [requests](https://requests.readthedocs.io/en/latest/) and [tqdm](https://github.com/tqdm/tqdm)\n\n**Why use this package instead of other wrappers?**\n\nThis package supports regions and so you can use it with Amplitude accounts in the EU and USA.\n\nThis package also supports using a proxy so you can keep your project API keys and API secrets confidential.\n\n## Supported Amplitude APIs and docs\n\n- [Amplitude data wrapper](#amplitude-data-wrapper)\n - [Supported Amplitude APIs and docs](#supported-amplitude-apis-and-docs)\n - [Dashboard Rest API](#dashboard-rest-api)\n - [Privacy API](#privacy-api)\n - [Cohort API](#cohort-api)\n - [Export API](#export-api)\n - [Taxonomy API](#taxonomy-api)\n\nSee examples below and in [example.py](example.py)\n\nInstall with\n\n```bash\npip install amplitude-data-wrapper\n```\n\nor\n\n```bash\nuv add amplitude-data-wrapper\n```\n\n### Dashboard Rest API\n\n[Results from an existing chart](https://developers.amplitude.com/docs/dashboard-rest-api#results-from-an-existing-chart)\n\nGet data from EU account by setting `region=1`.\n\n```python\nimport amplitude_data_wrapper.analytics_api as amp\n\n# without proxy\nr = amp.get_chart(\n api_key=api_key, secret=api_secret, chart_id=chart_id_eu, region=1\n) # region 1 is EU\nr.status_code\nr.json() # returns data as json\n```\n\nGet data from US account by setting `region=2`.\n\n```python\nr = amp.get_chart(\n api_key=api_key, secret=api_secret, chart_id=chart_id_eu, region=2\n) # region 2 is USA\nr.json() # returns data as json\n```\n\nGet data from EU account with a proxy by setting region and proxy using a dictionary.\n\n```python\n\n# with proxy\nproxies = {\"http\": \"http://myproxy.example.org/method\"}\nr = amp.get_chart(api_key, api_secret, chart_id_eu, region=1, proxy=proxies)\nr.status_code # print status code\n```\n\n[Event segmentation](https://developers.amplitude.com/docs/dashboard-rest-api#event-segmentation) lets you export events with segments and filters.\n\n```python\nour_event_dict = {\n \"event_type\": \"pageview\",\n \"group_by\": [{\"type\": \"event\", \"value\": \"app\"}, {\"type\": \"event\", \"value\": \"team\"}],\n}\ndata = amp.get_event_segmentation(\n api_key=api_key,\n secret=api_secret,\n start=\"20220601\",\n end=\"20220602\",\n event=our_event_dict,\n metrics=\"uniques\",\n interval=1,\n limit=1000,\n)\n```\n\n[User search](https://developers.amplitude.com/docs/dashboard-rest-api#user-search) lets you search for a user with a specific Amplitude ID, Device ID, User ID, or User ID prefix.\n\n```python\nuser = amp.find_user(\n user=example_id_eu, \n api_key=api_key, \n secret=api_secret,\n region=1)\n```\n\n### Privacy API\n\nDelete user data with a [deletion job](https://developers.amplitude.com/docs/user-deletion#deletion-job)\n\n```python\ndeleteme = amp.delete_user_data(\n user[\"matches\"][0][\"amplitude_id\"],\n email=email,\n api_key=api_key,\n secret=api_secret,\n region=1,\n ignore_invalid_id=True,\n delete_from_org=False,\n)\n```\n\n[Get a list of deletion jobs](https://developers.amplitude.com/docs/user-deletion#get)\n\n```python\ntobe_deleted = amp.get_deletion_jobs(\n start=\"2022-06-01\",\n end=\"2022-07-01\",\n api_key=api_key,\n secret=api_secret,\n region=1,\n)\n```\n\n### Cohort API\n\n[Getting one cohort](https://developers.amplitude.com/docs/behavioral-cohorts-api#getting-one-cohort)\n\n```python\nproxies = {\"http\": \"http://myproxy.domain.org/path\"}\nfile_path = \"path-to/cohortdata.csv\"\nkull = amp.get_cohort(\n api_key,\n api_secret,\n cohort_id,\n filename=file_path,\n props=1,\n region=1,\n proxy=proxies,\n)\n```\n\n### Export API\n\n[Export API - Export your project's event data](https://developers.amplitude.com/docs/export-api#export-api---export-your-projects-event-data)\n\n```python\nstart = \"20220601T00\"\nend = \"20220601T01\"\ndata = amp.export_project_data(\n start=start,\n end=end,\n api_key=api_key,\n secret=api_secret,\n filename=\"path-to/projectdata_eu.zip\",\n region=1,\n)\n```\n\n### Taxonomy API\n\n[Get all event types](https://developers.amplitude.com/docs/taxonomy-api#get-all-event-types)\n\n```python\ntypes = amp.get_all_event_types(\n api_key=api_key, \n secret=api_secret, \n region=1)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "python wrapper for using the amplitude analytics and taxonomy APIs",
"version": "0.5.8",
"project_urls": {
"Homepage": "https://github.com/navikt/amplitude-data-wrapper"
},
"split_keywords": [
"amplitude"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8e21c7f7b0c9afacf1a246f9bcd82762b10f3f0c379fb073106798f012d22c32",
"md5": "20121885acd69e8ba1df61e7e4a4cd1e",
"sha256": "40fcd568f3c5919449a61a6f73173b6fa7f0ee19ec7eb3fcccb1409dfd1982ec"
},
"downloads": -1,
"filename": "amplitude_data_wrapper-0.5.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "20121885acd69e8ba1df61e7e4a4cd1e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 7545,
"upload_time": "2025-10-17T10:40:04",
"upload_time_iso_8601": "2025-10-17T10:40:04.844290Z",
"url": "https://files.pythonhosted.org/packages/8e/21/c7f7b0c9afacf1a246f9bcd82762b10f3f0c379fb073106798f012d22c32/amplitude_data_wrapper-0.5.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0e323cd4ec19e19833935cad17ffa7b64d7a582e0a94bc85c6668dc72611f7dc",
"md5": "d56e226cb7cd6ec39e52007d749f61bb",
"sha256": "99219c5405cfd2471f2f86d67843cf8fed887a89262569268bbd5d47b1a77295"
},
"downloads": -1,
"filename": "amplitude_data_wrapper-0.5.8.tar.gz",
"has_sig": false,
"md5_digest": "d56e226cb7cd6ec39e52007d749f61bb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 8300,
"upload_time": "2025-10-17T10:40:06",
"upload_time_iso_8601": "2025-10-17T10:40:06.008821Z",
"url": "https://files.pythonhosted.org/packages/0e/32/3cd4ec19e19833935cad17ffa7b64d7a582e0a94bc85c6668dc72611f7dc/amplitude_data_wrapper-0.5.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-17 10:40:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "navikt",
"github_project": "amplitude-data-wrapper",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "amplitude-data-wrapper"
}