Nov-08-2019, 10:21 PM
Hello All
would welcome any advice on the following thank you
I am trying to use Apple's Connect API to download reports (sales etc.
the following code runs with out any error but I cant find an example of how to use the JWT
I have also tried using appstoreconnect as follows however I get a token error
<appstoreconnect.api.Api object at 0x00000275AC86EB00>
Traceback (most recent call last):
File "C:\src\Sandbox\python\test2.py", line 13, in <module>
for app in apps:
File "C:\Users\DevUser\AppData\Local\Programs\Python\Python36\lib\site-packages\appstoreconnect\api.py", line 79, in __next__
self.fetch_page()
File "C:\Users\DevUser\AppData\Local\Programs\Python\Python36\lib\site-packages\appstoreconnect\api.py", line 96, in fetch_page
self.payload = self.api._api_call(self.url)
File "C:\Users\DevUser\AppData\Local\Programs\Python\Python36\lib\site-packages\appstoreconnect\api.py", line 134, in _api_call
raise APIError(payload.get('errors', [])[0].get('detail', 'Unknown error'))
appstoreconnect.api.APIError: Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-g...ing-tokens
would welcome any advice on the following thank you
I am trying to use Apple's Connect API to download reports (sales etc.
the following code runs with out any error but I cant find an example of how to use the JWT
from datetime import datetime, timedelta import jwt KEY_ID = "mykey_id" ISSUER_ID = "issuse_id_string" PRIVATE_KEY = Auth key file on my pc.p8" TIMESTAMP = int( (datetime.now() - timedelta(minutes = 45)).timestamp() * 1000) claim = {"iss" : ISSUER_ID, "exp" : TIMESTAMP, "aud" : "appstoreconnect-v1"} header = { "alg": "ES256", "kid": KEY_ID, "typ": "JWT" } # Create the JWT jwttoken = jwt.encode(claim, PRIVATE_KEY, algorithm='ES256', headers=header)Would anyone know where i can find a simple example on using "jwttoken"??
I have also tried using appstoreconnect as follows however I get a token error
from appstoreconnect import Api KEY_ID = "mykey_id" ISSUER_ID = "issuse_id_string" PRIVATE_KEY = Auth key file on my pc.p8" api = Api(KEY_ID, PRIVATE_KEY, ISSUER_ID) print (api) apps = api.list_apps() for app in apps: print(app)Error follows
<appstoreconnect.api.Api object at 0x00000275AC86EB00>
Traceback (most recent call last):
File "C:\src\Sandbox\python\test2.py", line 13, in <module>
for app in apps:
File "C:\Users\DevUser\AppData\Local\Programs\Python\Python36\lib\site-packages\appstoreconnect\api.py", line 79, in __next__
self.fetch_page()
File "C:\Users\DevUser\AppData\Local\Programs\Python\Python36\lib\site-packages\appstoreconnect\api.py", line 96, in fetch_page
self.payload = self.api._api_call(self.url)
File "C:\Users\DevUser\AppData\Local\Programs\Python\Python36\lib\site-packages\appstoreconnect\api.py", line 134, in _api_call
raise APIError(payload.get('errors', [])[0].get('detail', 'Unknown error'))
appstoreconnect.api.APIError: Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-g...ing-tokens