Created
July 9, 2019 21:12
-
-
Save ashwinvis/b7c749a652471ddfd12546abe2d58b75 to your computer and use it in GitHub Desktop.
Unstar Github
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
# coding: utf-8 | |
""" | |
Ref | |
--- | |
* https://pygithub.readthedocs.io/en/latest/introduction.html#very-short-tutorial | |
If you are using an access token to circumvent 2FA, make sure you have | |
enabled "repo" scope | |
Troubleshooting | |
--------------- | |
* https://developer.github.com/v3/activity/starring/#unstar-a-repository | |
Debug using curl: | |
$ curl -H "Authorization: token $INSERT_ACCESS_TOKEN" \ | |
"https://api.github.com/user/starred/<owner>/<repo>" -i -s -X DELETE | |
Requires: | |
$ pip install pygithub==1.43.7 | |
""" | |
import random | |
import time | |
from pygithub import Github | |
g = Github("username", "password") | |
me = g.get_user() | |
starred = me.get_starred() | |
for repo in starred: | |
print("Unstarring", repo) | |
me.remove_from_starred(repo) | |
time.sleep(1 + random.random()) # try to avoid rate-limit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment