Skip to content

Instantly share code, notes, and snippets.

@arkokoley
Created February 28, 2018 18:08
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arkokoley/c86177006a2f2d42f280eacb0a590a30 to your computer and use it in GitHub Desktop.
Save arkokoley/c86177006a2f2d42f280eacb0a590a30 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