Convenient interface to **download Analytics Reports** from the [App Store Connect API](https://developer.apple.com/documentation/appstoreconnectapi). It handles authentication using JWT, manages requests, and retrieves analytics data for app usage, sales, crashes, and more.
Project description
๐ AppStoreConnect Analytics Reports Python Package
Simplified access to Apple App StoreConnect Analytics Reports via API
โจ Overview
This Python package provides a convenient interface to download Analytics Reports from the App Store Connect API. It handles authentication using JWT, manages requests, and retrieves analytics data for app usage, sales, crashes, and more.
๐ Features
- JWT Authentication using private key and issuer ID
- Download Analytics Reports for a given app and date
- Support for report types:
ONGOING,ONE_TIME_SNAPSHOT - Full fetch of history including APP Customer Reviews
- Unit-tested core components
๐ฆ Installation
pip install surquest-utils-appstoreconnect-analyticsreports
Or clone this repo:
git clone git@github.com:surquest/python-appstoreconnect-analyticsreports.git
cd src/surquest/utils
pip install --no-cache-dir -r requirements.txt
๐ง Setup
To use this package, you will need:
- Apple App Store Connect API Issuer ID
- Your Key ID
- A
.p8private key downloaded from App Store Connect
Set your credentials in a .env file or pass them directly to the client.
ISSUER_ID=your_issuer_id
KEY_ID=your_key_id
PRIVATE_KEY=-----BEGIN PRIVATE KEY-----???-----END PRIVATE KEY-----
๐งโ๐ป Usage Example
import os
from surquest.utils.appstoreconnect.credentials import Credentials
from surquest.utils.appstoreconnect.analyticsreports.client import Client
from surquest.utils.appstoreconnect.analyticsreports.handler import Handler
from surquest.utils.appstoreconnect.analyticsreports.enums.category import Category
from surquest.utils.appstoreconnect.analyticsreports.enums.granularity import Granularity
from surquest.utils.appstoreconnect.analyticsreports.enums.report_name import ReportName
APP_ID = "123456789"
REPORT_NAME = ReportName.APP_SESSIONS_STANDARD
ACCESS_TYPE = "ONGOING"
GRANULARITY = Granularity.DAILY
CSV_PATH = "./your/path/to/export/data.csv"
credentials = Credentials(
issuer_id=os.getenv('ISSUER_ID'),
key_id=os.getenv('KEY_ID'),
private_key_path=os.getenv('PRIVATE_KEY'),
)
client = Client(credentials=credentials)
# Example: Download analytics data
data = client.get_data(
app_id = APP_ID,
report_name = REPORT_NAME,
access_type = "ONE_TIME_SNAPSHOT"
)
Handler.list_of_dicts_to_csv(data, CSV_PATH)
๐ Supported Report Parameters
| Parameter | Description |
|---|---|
report_name |
Enum specified in ReportName surquest.utils.appstoreconnect.analyticsreports.enums.report_name.ReportName |
granularity |
Enum specified in surquest.utils.appstoreconnect.analyticsreports.enums.granularity.Granularity |
dates |
Set of dates in YYYY-MM-DD format |
๐งช Running Tests
pytest tests/
๐ Project Structure
src/
โโโ surquest/
โโโ utils/
โโโ appstoreconnect/
โโโ __init__.py
โโโ credentials.py
โโโ requirements.txt
โโโ analyticsreports/
โโโ __init__.py
โโโ client.py
โโโ errors.py
โโโ handler.py
โโโ enums/
โโโ __init__.py
โโโ category.py
โโโ granularity.py
โโโ report_name.py
tests/
โโโ surquest/
โโโ utils/
โโโ appstoreconnect/
โโโ analyticsreports/
โโโ test_client.py
README.md
pyproject.toml
LICENSE
.gitignore
๐ก๏ธ Disclaimer
This project is not affiliated with Apple Inc. Use responsibly and according to Appleโs Terms of Use.
๐ License
MIT License
๐โโ๏ธ Contact / Contribute
PRs welcome! For bugs or feature requests, open an issue.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file surquest_utils_appstoreconnect_analyticsreports-0.0.1.tar.gz.
File metadata
- Download URL: surquest_utils_appstoreconnect_analyticsreports-0.0.1.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df997d98890df111044044dcea3ebd55b5a6e106a59f646f0314127f41ccb47a
|
|
| MD5 |
b87830fd6d458d019dd1c4e4fee9b5a6
|
|
| BLAKE2b-256 |
5577625fefb864163955070b61f6e8854f467cda09f8f8dea56a6682e0426b0a
|
File details
Details for the file surquest_utils_appstoreconnect_analyticsreports-0.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: surquest_utils_appstoreconnect_analyticsreports-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dec0f1237e4ef1468f99f38aa018fd551492a3a1bd5c00d4d1994dfe0151fc8
|
|
| MD5 |
3fe73d0ab26211a6def11aba4d2806ed
|
|
| BLAKE2b-256 |
2f05f0bb902de4f21a30195c5306da037e22ffdd942fdde3ca7db4eb21fb05c0
|