Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yangyubo/497a56b9347a99730c83ab23db74f2b9 to your computer and use it in GitHub Desktop.
Save yangyubo/497a56b9347a99730c83ab23db74f2b9 to your computer and use it in GitHub Desktop.
Connection to the App Store Connect API using Python3 and Applaud

How to connect to the App Store Connect API using Python3 and Applaud

You will need the Applaud packages. Just run :

$ pip install applaud

Then you need to generate an API Key from the App Store Connect portal (https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api).

In the Python code below, replace the values of KEY_ID, ISSUER_ID and PATH_TO_KEY with your own.

You can use different endpoint entries to perform all kinds of tasks on App Store Connect service.

Finally, if you have some query parameters to pass in, use the filter(), fileds(), include(), limit(), sort(), exists() functions of the endpoint object.

The original "Uploading App Previews" sample code by Apple also has an Appluad counterpart, you can find it here UploadingAppPreviews

import os
from applaud.connection import Connection
KEY_ID = "XXXXXXXXXX"
ISSUER_ID = "XXXXXX-XXXXXXX-XXXXXX-XXXXXXX"
PATH_TO_KEY = os.path.expanduser('path/to/your/key.p8')
with open(PATH_TO_KEY, 'r') as f:
PRIVATE_KEY = f.read()
# Create the Connection
connection = Connection(ISSUER_ID, KEY_ID, PRIVATE_KEY)
# API Request
r = connection.users().limit(10).get()
# Print user names
for user in r.data:
print(user.attributes.username, user.attributes.first_name, user.attributes.last_name)
# Write the response in a pretty printed JSON file
with open('output.json', 'w') as out:
out.write(r.json(indent=4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment