Skip to content

Instantly share code, notes, and snippets.

@daicham
Last active December 10, 2015 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daicham/4507205 to your computer and use it in GitHub Desktop.
Save daicham/4507205 to your computer and use it in GitHub Desktop.
Request Redmine SCM fetching by http on Python (Tested for Mercurial)
# usase:
# python redmine.py projectname1, projectname2
import sys, httplib
REDMINE_HOST = 'localhost:3000'
URL = '/redmine/sys/fetch_changesets?id=%s&key=%s'
REDMINE_API_KEY = 'token'
redmine_project_ids = sys.argv
redmine_project_ids.pop(0) # shift operation to reduce this command
for project_id in redmine_project_ids:
http = httplib.HTTPConnection(REDMINE_HOST)
url = URL % (project_id, REDMINE_API_KEY)
http.request('GET', url)
response = http.getresponse()
#print response.status, response.reason, url # debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment