Skip to main content

App Store Connect Api for Home Assistant

This is a fork of appstoreconnect : https://pypi.org/project/appstoreconnect/

This project removes some of the dependencies.


This is a Python wrapper around the Apple App Store Api : https://developer.apple.com/documentation/appstoreconnectapi

So far, it handles token generation / expiration, methods for listing resources and downloading reports.

Installation

Version

The project is published on PyPI, install with:

pip install appstoreconnect

Usage

Please follow instructions on Apple documentation on how to generate an API key.

With your key ID, key file (you can either pass the path to the file or the content of it as a string) and issuer ID create a new API instance:

from appstoreconnect import Api, UserRole
api = Api(key_id, path_to_key_file, issuer_id)

# use a proxy
api = Api(key_id, path_to_key_file, issuer_id, proxy='http://1.2.3.4:3128')

# set a timeout (in seconds) for requests
api = Api(key_id, path_to_key_file, issuer_id, timeout=42)

Here are a few examples of API usage. For a complete list of available methods please see api.py.

# list all apps
apps = api.list_apps()
for app in apps:
    print(app.name, app.sku)

# sort resources
apps = api.list_apps(sort='name')

# filter apps
apps = api.list_apps(filters={'sku': 'DINORUSH', 'name': 'Dino Rush'})
print("%d apps found" % len(apps))

# read app information
app = api.read_app_information('1308363336')
print(app.name, app.sku, app.bundleId)

# get a related resource
for group in app.betaGroups():
    print(group.name)

# list bundle ids
for bundle_id in api.list_bundle_ids():
    print(bundle_id.identifier)

# list certificates
for certificate in api.list_certificates():
    print(certificate.name)

# modify a user
user = api.list_users(filters={'username': 'finance@nemoidstudio.com'})[0]
api.modify_user_account(user, roles=[UserRole.FINANCE, UserRole.ACCESS_TO_REPORTS])
    
# download sales report
api.download_sales_and_trends_reports(
    filters={'vendorNumber': '123456789', 'frequency': 'WEEKLY', 'reportDate': '2019-06-09'}, save_to='report.csv')

# download finance report
api.download_finance_reports(filters={'vendorNumber': '123456789', 'reportDate': '2019-06'}, save_to='finance.csv')

Define a timeout (in seconds) after which an exception is raised if no response is received.

api = Api(key_id, path_to_key_file, issuer_id, timeout=30)
api.list_apps()

APIError: Read timeout after 30 seconds

Please note this is a work in progress, API is subject to change between versions.

Anonymous data collection

Starting with version 0.8.0 this library anonymously collects its usage to help better improve its development. What we collect is:

  • a SHA1 hash of the issuer_id
  • the OS and Python version used
  • which enpoints had been used

You can review the source code

If you feel uncomfortable with it you can completely opt-out by initliazing the API with:

api = Api(key_id, path_to_key_file, issuer_id, submit_stats=False)

The is also an open issue about this topic where we would love to here your feedback and best practices.

Development

Project development happens on Github

TODO

  • Support App Store Connect API 1.2
  • Support the include parameter
  • handle POST, DELETE and PATCH requests
  • sales report
  • handle related resources
  • allow to sort resources
  • proper API documentation
  • add tests

Credits

This project is developed by Ponytech

Metadata

Release files for appstoreconnect-BPHvZ 0.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for appstoreconnect-BPHvZ 0.10.1
File Size Uploaded Provenance
appstoreconnect_BPHvZ-0.10.1.tar.gz 13.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for appstoreconnect-BPHvZ 0.10.1
File Interpreter ABI Platform
appstoreconnect_BPHvZ-0.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.9 kB

Release files / appstoreconnect_BPHvZ-0.10.1.tar.gz

Download URL appstoreconnect_BPHvZ-0.10.1.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c359067b525011bd77d77d6dbb27cdc02292cd730df0fd064d9668c94b5e6137
BLAKE2b-256 checksum
How to use checksums
eb9d8f0443960b89766ab4925412164ada755a14d523a836e741a2cdc4e2dddc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / appstoreconnect_BPHvZ-0.10.1-py3-none-any.whl

Download URL appstoreconnect_BPHvZ-0.10.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9761346a4e7d73726ae419ac27bf0dbcbccf4adf5065f1e2e9a46e9fc38079ee
BLAKE2b-256 checksum
How to use checksums
f27846c1198820f66063f91018e6573faafaf231d9d78c4b12e0bda35cb24881
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Security for appstoreconnect-BPHvZ 0.10.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page