diff --git a/bin/github-backup b/bin/github-backup index 186e2a0..ec3f738 100755 --- a/bin/github-backup +++ b/bin/github-backup @@ -271,7 +271,7 @@ def get_auth(args, encode=True): if encode == False: return auth - return base64.b64encode(auth) + return base64.b64encode(auth.encode('ascii')) def get_github_api_host(args): @@ -326,7 +326,7 @@ def retrieve_data(args, template, query_args=None, single_request=False): errors.append(template.format(status_code, r.reason)) log_error(errors) - response = json.loads(r.read()) + response = json.loads(r.read().decode('utf-8')) if len(errors) == 0: if type(response) == list: data.extend(response) @@ -382,7 +382,7 @@ def _construct_request(per_page, page, query_args, template, auth): request = Request(template + '?' + querystring) if auth is not None: - request.add_header('Authorization', 'Basic ' + auth) + request.add_header('Authorization', 'Basic '.encode('ascii') + auth) return request