Skip to content

Instantly share code, notes, and snippets.

@cchitsiang
Forked from arkokoley/star.py
Created December 13, 2018 02:55
Show Gist options
  • Save cchitsiang/939583c6fd01689a524d5288649ec0df to your computer and use it in GitHub Desktop.
Save cchitsiang/939583c6fd01689a524d5288649ec0df to your computer and use it in GitHub Desktop.
Auto star repo in github
'''
Author: Gaurav Koley (arkokoley@live.in)
'''
import requests
import sys
from requests.auth import HTTPBasicAuth
username = raw_input("username: ")
password = raw_input("password: ")
users = sys.argv[1:]
for user in users:
url = 'https://api.github.com/users/'+user+'/repos'
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8'}
r = requests.get(url, headers=headers, auth=HTTPBasicAuth(username, password))
repos = r.json()
for repo in repos:
print 'https://api.github.com/user/starred/'+repo['owner']['login']+"/"+repo['name']
r = requests.put('https://api.github.com/user/starred/'+repo['owner']['login']+"/"+repo['name'], auth=HTTPBasicAuth(username, password), headers={'Content-Length': '0'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment