Created
June 16, 2015 21:00
-
-
Save nicoddemus/8a5656dcc5d0411ae6de to your computer and use it in GitHub Desktop.
Close bitbucket issues for pytest repository, after migrating to GitHub
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
import requests | |
auth = ('nicoddemus', 'XXXX') | |
for issue_id in xrange(1, 768+1): | |
url = 'https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/issues/{issue_id}/comments' | |
url = url.format(accountname='pytest-dev', repo_slug='pytest', issue_id=issue_id) | |
print '-' *10, issue_id | |
data = { | |
"content": "This issue has been moved to GitHub: https://github.com/pytest-dev/pytest/issues/{issue_id}".format(issue_id=issue_id), | |
} | |
respo = requests.post(url, data=data, auth=auth) | |
if respo.status_code != 200: | |
print respo.text | |
#print respo.json() | |
url = 'https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/issues/{issue_id}' | |
url = url.format(accountname='pytest-dev', repo_slug='pytest', issue_id=issue_id) | |
data = { | |
'status': 'on hold', | |
} | |
respo = requests.put(url, data=data, auth=auth) | |
if respo.status_code != 200: | |
print respo.text | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment