-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an example on how to user modify_user_account
- Loading branch information
Showing
2 changed files
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ Please follow instructions on [Apple documentation](https://developer.apple.com/ | |
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: | ||
|
||
```python | ||
from appstoreconnect import Api | ||
from appstoreconnect import Api, UserRole | ||
api = Api(key_id, path_to_key_file, issuer_id) | ||
``` | ||
|
||
|
@@ -57,6 +57,10 @@ for bundle_id in api.list_bundle_ids(): | |
for certificate in api.list_certificates(): | ||
print(certificate.name) | ||
|
||
# modify a user | ||
user = api.list_users(filters={'username': '[email protected]'})[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') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
from appstoreconnect import Api | ||
from appstoreconnect import Api, UserRole | ||
|
||
|
||
if __name__ == "__main__": | ||
|
@@ -19,6 +19,10 @@ | |
apps = api.list_apps(filters={'sku': 'DINORUSH', 'name': 'Dino Rush'}) | ||
print("%d apps found" % len(apps)) | ||
|
||
# modify a user | ||
user = api.list_users(filters={'username': '[email protected]'})[0] | ||
api.modify_user_account(user, roles=[UserRole.FINANCE, UserRole.APP_MANAGER, 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') | ||
|