Skip to content

Commit

Permalink
Add an example on how to user modify_user_account
Browse files Browse the repository at this point in the history
  • Loading branch information
ppawlak committed Jan 9, 2021
1 parent ce2de7b commit d486650
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand Down Expand Up @@ -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')
Expand Down
6 changes: 5 additions & 1 deletion example.py
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__":
Expand All @@ -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')
Expand Down

0 comments on commit d486650

Please sign in to comment.