From a3ad32bd91e405d918276c50d2995cd86764e518 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Wed, 10 Jun 2015 16:15:00 +0900 Subject: [PATCH] Use requests instead - SSL handling is superior --- contrib/make_locale | 7 ++++--- lib/paymentrequest.py | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/make_locale b/contrib/make_locale index 6f9d1543..2744e77e 100755 --- a/contrib/make_locale +++ b/contrib/make_locale @@ -1,6 +1,7 @@ #!/usr/bin/env python2 from StringIO import StringIO -import urllib2, os, zipfile, pycurl +import os, zipfile, pycurl +import requests os.chdir(os.path.dirname(os.path.realpath(__file__))) os.chdir('..') @@ -31,12 +32,12 @@ if os.path.exists('../contrib/crowdin_api_key.txt'): c.perform() # Build translations print 'Build translations' - response = urllib2.urlopen('http://api.crowdin.net/api/project/' + crowdin_identifier + '/export?key=' + crowdin_api_key).read() + response = requests.request('GET', 'http://api.crowdin.net/api/project/' + crowdin_identifier + '/export?key=' + crowdin_api_key).content print response # Download & unzip print 'Download translations' -zfobj = zipfile.ZipFile(StringIO(urllib2.urlopen('http://crowdin.net/download/project/' + crowdin_identifier + '.zip').read())) +zfobj = zipfile.ZipFile(StringIO(requests.request('GET', 'http://crowdin.net/download/project/' + crowdin_identifier + '.zip').content)) print 'Unzip translations' for name in zfobj.namelist(): diff --git a/lib/paymentrequest.py b/lib/paymentrequest.py index 8a699b4e..2367fb10 100644 --- a/lib/paymentrequest.py +++ b/lib/paymentrequest.py @@ -24,7 +24,6 @@ import sys import threading import time import traceback -import urllib2 import urlparse import requests