You will need the requests and authlib packages. Just run :
$ pip install requests authlibThen 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 change the URL of the request you want to make with the URL variable.
Finally, if you have some query parameters to pass in, use the params parameter of requests.get() (or requests.post()).
If you have the same problem 401 ->
check your jwt encode in https://jwt.io, just paste in form Encoded your token after jwt.encode. You must see correct headers and payload. It helps me to find error.