Skip to content

Commit

Permalink
Simplify HTTPBasicAuth arguments.
Browse files Browse the repository at this point in the history
This makes sf2github compatible with older python-requests
versions, such as 0.8.2 (shipped e.g. with Ubuntu 12.04).
  • Loading branch information
ockham committed Mar 18, 2013
1 parent fdad3d1 commit a887c2b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions issues.py
Expand Up @@ -34,17 +34,16 @@
from time import sleep from time import sleep
from getpass import getpass from getpass import getpass
import requests import requests
from requests.auth import HTTPBasicAuth
import json import json
import re import re


def __rest_call_unchecked(method, request, data=None): def __rest_call_unchecked(method, request, data=None):
global github_repo, github_user, github_password global github_repo, github_user, github_password
url = 'https://api.github.com/repos/%s/%s' % (github_repo, request) url = 'https://api.github.com/repos/%s/%s' % (github_repo, request)
if method == 'PATCH': 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: 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 # GitHub limits API calls to 60 per minute
sleep(1) sleep(1)
return response return response
Expand Down

0 comments on commit a887c2b

Please sign in to comment.