mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-05 05:15:12 +00:00
Merge pull request #1286 from kyuupichan/remove_urllib2
Use requests instead - SSL handling is superior
This commit is contained in:
commit
2b9b42d5f7
2 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
from StringIO import StringIO
|
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(os.path.dirname(os.path.realpath(__file__)))
|
||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
|
@ -31,12 +32,12 @@ if os.path.exists('../contrib/crowdin_api_key.txt'):
|
||||||
c.perform()
|
c.perform()
|
||||||
# Build translations
|
# Build translations
|
||||||
print '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
|
print response
|
||||||
|
|
||||||
# Download & unzip
|
# Download & unzip
|
||||||
print 'Download translations'
|
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'
|
print 'Unzip translations'
|
||||||
for name in zfobj.namelist():
|
for name in zfobj.namelist():
|
||||||
|
|
|
@ -24,7 +24,6 @@ import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import urllib2
|
|
||||||
import urlparse
|
import urlparse
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue