Metadata-Version: 2.4
Name: dlt-source-app-store-connect
Version: 0.2.0
Summary: A dlt source for Apple App Store Connect API
Project-URL: Homepage, https://github.com/ota2000/dlt-source-app-store-connect
Project-URL: Repository, https://github.com/ota2000/dlt-source-app-store-connect
Project-URL: Changelog, https://github.com/ota2000/dlt-source-app-store-connect/releases
Project-URL: Issues, https://github.com/ota2000/dlt-source-app-store-connect/issues
Author: ota2000
License: MIT
License-File: LICENSE
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.12
Requires-Dist: dlt>=1.0.0
Requires-Dist: pyjwt[crypto]>=2.8.0
Description-Content-Type: text/markdown

# dlt-source-app-store-connect

[![CI](https://github.com/ota2000/dlt-source-app-store-connect/actions/workflows/ci.yaml/badge.svg)](https://github.com/ota2000/dlt-source-app-store-connect/actions/workflows/ci.yaml)
[![PyPI](https://img.shields.io/pypi/v/dlt-source-app-store-connect)](https://pypi.org/project/dlt-source-app-store-connect/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)

A [dlt](https://dlthub.com/) source for [Apple App Store Connect API](https://developer.apple.com/documentation/appstoreconnectapi).

## Features

- 15 resources covering apps, builds, TestFlight, subscriptions, and reports
- Incremental loading for sales, finance, and analytics reports
- Automatic JWT token refresh
- Rate limit handling with exponential backoff
- Works with any [dlt destination](https://dlthub.com/docs/dlt-ecosystem/destinations/) (BigQuery, Snowflake, DuckDB, etc.)

## Installation

```bash
pip install dlt-source-app-store-connect
```

Or with uv:

```bash
uv add dlt-source-app-store-connect
```

## Quick start

```python
import dlt
from dlt_source_app_store_connect import app_store_connect_source

pipeline = dlt.pipeline(
    pipeline_name="app_store_connect",
    destination="bigquery",  # or any dlt destination
    dataset_name="source_app_store_connect",
)

source = app_store_connect_source(
    key_id="YOUR_KEY_ID",
    issuer_id="YOUR_ISSUER_ID",
    private_key=open("AuthKey_XXXXX.p8").read(),
    vendor_number="YOUR_VENDOR_NUMBER",  # required for sales/finance reports
)

load_info = pipeline.run(source)
print(load_info)
```

### Load specific resources

```python
source = app_store_connect_source(
    key_id="YOUR_KEY_ID",
    issuer_id="YOUR_ISSUER_ID",
    private_key=open("AuthKey_XXXXX.p8").read(),
    resources=["apps", "builds", "sales_reports"],
)
```

## Resources

| Resource | Write Disposition | Incremental | Description |
|---|---|---|---|
| `apps` | merge | - | App metadata |
| `app_store_versions` | merge | - | App Store version history |
| `builds` | merge | - | Build information |
| `beta_testers` | merge | - | TestFlight testers |
| `beta_groups` | merge | - | TestFlight groups |
| `bundle_ids` | merge | - | Bundle identifiers |
| `certificates` | merge | - | Signing certificates |
| `devices` | merge | - | Registered devices |
| `in_app_purchases` | merge | - | In-app purchase products |
| `subscriptions` | merge | - | Subscription products |
| `subscription_groups` | merge | - | Subscription groups |
| `users` | merge | - | Team members |
| `sales_reports` | append | daily | Sales and trends reports |
| `finance_reports` | append | monthly | Financial reports |
| `analytics_reports` | append | by processing date | Analytics reports |

`sales_reports` and `finance_reports` require `vendor_number`.

## Authentication

You need an API key from [App Store Connect](https://appstoreconnect.apple.com/access/integrations/api).

Required credentials:

| Parameter | Description |
|---|---|
| `key_id` | The identifier for your API key |
| `issuer_id` | Your team's issuer ID |
| `private_key` | Contents of the `.p8` file downloaded when creating the key |
| `vendor_number` | Your vendor number (required for sales/finance reports) |

## Development

```bash
git clone https://github.com/ota2000/dlt-source-app-store-connect.git
cd dlt-source-app-store-connect
uv sync --group dev
uv run pytest -v
uv run ruff check .
```

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

## License

MIT
