-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only works on public issues/repositories on bitbucket #8
Comments
I added authentication to my local copy based on this: http://stackoverflow.com/questions/635113/python-urllib2-basic-http-authentication-and-tr-im bitbucket username and password were hardcoded in the base64string lines... obviously not ideal. Here's the diff: diff --git a/migrate.py b/migrate.py
old mode 100644
new mode 100755
index 95e1dda..ef5d5bc
--- a/migrate.py
+++ b/migrate.py
@@ -19,7 +19,7 @@ from datetime import datetime, timedelta
import urllib2
import time
import getpass
-
+import base64
import sys
try:
@@ -121,7 +121,10 @@ def get_comments(issue):
Fetch the comments for an issue
'''
url = "https://api.bitbucket.org/1.0/repositories/%s/%s/issues/%s/comments/" % (options.bitbucket_username, options.bitbucket_repo, issu
- result = json.loads(urllib2.urlopen(url).read())
+ request = urllib2.Request(url)
+ base64string = base64.encodestring('%s:%s' % ('', '')).replace('\n','')
+ request.add_header("Authorization", "Basic %s" % base64string)
+ result = json.loads(urllib2.urlopen(request).read())
comments = []
for comment in result:
@@ -143,7 +146,10 @@ issues = []
while True:
url = "https://api.bitbucket.org/1.0/repositories/%s/%s/issues/?start=%d" % (options.bitbucket_username, options.bitbucket_repo, options
try:
- response = urllib2.urlopen(url)
+ request = urllib2.Request(url)
+ base64string = base64.encodestring('%s:%s' % ('','')).replace('\n','')
+ request.add_header("Authorization", "Basic %s" % base64string)
+ response = urllib2.urlopen(request)
except urllib2.HTTPError as ex:
raise ValueError(
'Problem trying to connect to bitbucket ({url}): {ex} '
|
#22 tackles this. Waiting for it to be rebased before merging. |
If a user submits BB creds, but the BB repo is public, then we shouldn't worry about whether the user's BB creds are authentic, we should just use the public API to grab the issues without authenticating. So probably the workflow is:
|
Fixed in #59 |
Just a comment, not really an issue - this only works on issue trackers that are public in bitbucket, otherwise you'll get an HTTP error and the migration will fail.
The text was updated successfully, but these errors were encountered: