Skip to main content

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

Apple API Docs โ†’


โœจ 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 .p8 private 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


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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file surquest_utils_appstoreconnect_analyticsreports-0.0.1.tar.gz.

File metadata

File hashes

Hashes for surquest_utils_appstoreconnect_analyticsreports-0.0.1.tar.gz
Algorithm Hash digest
SHA256 df997d98890df111044044dcea3ebd55b5a6e106a59f646f0314127f41ccb47a
MD5 b87830fd6d458d019dd1c4e4fee9b5a6
BLAKE2b-256 5577625fefb864163955070b61f6e8854f467cda09f8f8dea56a6682e0426b0a

See more details on using hashes here.

File details

Details for the file surquest_utils_appstoreconnect_analyticsreports-0.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for surquest_utils_appstoreconnect_analyticsreports-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0dec0f1237e4ef1468f99f38aa018fd551492a3a1bd5c00d4d1994dfe0151fc8
MD5 3fe73d0ab26211a6def11aba4d2806ed
BLAKE2b-256 2f05f0bb902de4f21a30195c5306da037e22ffdd942fdde3ca7db4eb21fb05c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page