From a887c2b8faac16e4238f5ef374d12e3e2e5a86cb Mon Sep 17 00:00:00 2001 From: Bernhard Reiter Date: Sat, 16 Mar 2013 18:59:43 +0100 Subject: Simplify HTTPBasicAuth arguments. This makes sf2github compatible with older python-requests versions, such as 0.8.2 (shipped e.g. with Ubuntu 12.04). --- issues.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/issues.py b/issues.py index 1f5ca97..8ab7a45 100755 --- a/issues.py +++ b/issues.py @@ -34,7 +34,6 @@ from base64 import b64encode from time import sleep from getpass import getpass import requests -from requests.auth import HTTPBasicAuth import json import re @@ -42,9 +41,9 @@ def __rest_call_unchecked(method, request, data=None): global github_repo, github_user, github_password url = 'https://api.github.com/repos/%s/%s' % (github_repo, request) if method == 'PATCH': - response = requests.patch(url, data=json.dumps(data), auth=HTTPBasicAuth(github_user, github_password)) + response = requests.patch(url, data=json.dumps(data), auth=(github_user, github_password)) else: - response = requests.post(url, data=json.dumps(data), auth=HTTPBasicAuth(github_user, github_password)) + response = requests.post(url, data=json.dumps(data), auth=(github_user, github_password)) # GitHub limits API calls to 60 per minute sleep(1) return response -- cgit v1.2.3 From 49a6033252d49abd21e85d69862975a155de3f90 Mon Sep 17 00:00:00 2001 From: Bernhard Reiter Date: Sat, 16 Mar 2013 18:47:07 +0100 Subject: Remove obsolete imports. --- issues.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/issues.py b/issues.py index 8ab7a45..2fc9a24 100755 --- a/issues.py +++ b/issues.py @@ -28,9 +28,6 @@ soup = BeautifulStoneSoup(open(xml_file_name, 'r'), convertEntities=BeautifulSto trackers = soup.document.find('trackers', recursive=False).findAll('tracker', recursive=False) -from urllib import urlencode -from urllib2 import HTTPError -from base64 import b64encode from time import sleep from getpass import getpass import requests @@ -53,7 +50,7 @@ def rest_call(method, request, data=None): while True: try: return __rest_call_unchecked(method, request, data) - except HTTPError, e: + except requests.HTTPError, e: print "Got HTTPError:", e l = data_dict and max(map(len, data_dict.itervalues())) or 0 if e.code == 413 or l >= 100000: # Request Entity Too Large -- cgit v1.2.3