Last active
August 29, 2015 14:15
-
-
Save cosenal/88e78f455df2231e1103 to your computer and use it in GitHub Desktop.
unstar all items at once
This file contains hidden or 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
#!/usr/bin/env python | |
import requests | |
url = 'https://example.com/index.php/apps/news/api/v1-2/items' | |
username = 'user'; | |
password = 'pass'; | |
paramsAllStarred = { | |
'batchSize': -1, | |
'type': 2, | |
'id': 0, | |
'getRead': 'true' | |
} | |
r = requests.get(url, auth=(username, password), params=paramsAllStarred) | |
if r.status_code == 200: | |
allStarredItems = r.text | |
r = requests.put(url + '/unstar/multiple', auth=(username, password), | |
data=allStarredItems, headers={'Content-Type': 'application/json'}) | |
if r.status_code == 200: | |
print('Done!') | |
else: | |
print('Error') | |
else: | |
print('Error') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment