aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2018-06-18 12:53:27 -0700
committerMicah Lee <micah@micahflee.com>2018-06-18 12:53:27 -0700
commit7f9a27331ed7a150a8c7a323ed331948a4db0194 (patch)
tree78a1fafde99354549817994a8afe8df5c5f10bf7
parent53223bb52a2303ce0fb1c30488eb37c3460665b2 (diff)
downloadonionshare-7f9a27331ed7a150a8c7a323ed331948a4db0194.tar.gz
onionshare-7f9a27331ed7a150a8c7a323ed331948a4db0194.zip
Add requests build dependency, and use requests to download Tor Browser in get-tor-osx.py and get-tor-windows.py, because I was running into SSL certificate verification issues downloading using urllib
-rw-r--r--install/get-tor-osx.py18
-rw-r--r--install/get-tor-windows.py16
-rw-r--r--install/requirements-windows.txt1
-rw-r--r--install/requirements.txt1
4 files changed, 24 insertions, 12 deletions
diff --git a/install/get-tor-osx.py b/install/get-tor-osx.py
index 207ecfb3..3c498dfe 100644
--- a/install/get-tor-osx.py
+++ b/install/get-tor-osx.py
@@ -24,8 +24,15 @@ In order to avoid a Mac gnupg dependency, I manually verify the signature
and hard-code the sha256 hash.
"""
-import inspect, os, sys, hashlib, zipfile, io, shutil, subprocess
-import urllib.request
+import inspect
+import os
+import sys
+import hashlib
+import zipfile
+import io
+import shutil
+import subprocess
+import requests
def main():
dmg_url = 'https://archive.torproject.org/tor-package-archive/torbrowser/7.5.5/TorBrowser-7.5.5-osx64_en-US.dmg'
@@ -46,10 +53,9 @@ def main():
# Make sure the zip is downloaded
if not os.path.exists(dmg_path):
print("Downloading {}".format(dmg_url))
- response = urllib.request.urlopen(dmg_url)
- dmg_data = response.read()
- open(dmg_path, 'wb').write(dmg_data)
- dmg_sha256 = hashlib.sha256(dmg_data).hexdigest()
+ r = requests.get(dmg_url)
+ open(dmg_path, 'wb').write(r.content)
+ dmg_sha256 = hashlib.sha256(r.content).hexdigest()
else:
dmg_data = open(dmg_path, 'rb').read()
dmg_sha256 = hashlib.sha256(dmg_data).hexdigest()
diff --git a/install/get-tor-windows.py b/install/get-tor-windows.py
index e7783191..44c4ac23 100644
--- a/install/get-tor-windows.py
+++ b/install/get-tor-windows.py
@@ -24,8 +24,13 @@ In order to avoid a Windows gnupg dependency, I manually verify the signature
and hard-code the sha256 hash.
"""
-import inspect, os, sys, hashlib, shutil, subprocess
-import urllib.request
+import inspect
+import os
+import sys
+import hashlib
+import shutil
+import subprocess
+import requests
def main():
exe_url = 'https://archive.torproject.org/tor-package-archive/torbrowser/7.5.5/torbrowser-install-7.5.5_en-US.exe'
@@ -44,10 +49,9 @@ def main():
# Make sure the zip is downloaded
if not os.path.exists(exe_path):
print("Downloading {}".format(exe_url))
- response = urllib.request.urlopen(exe_url)
- exe_data = response.read()
- open(exe_path, 'wb').write(exe_data)
- exe_sha256 = hashlib.sha256(exe_data).hexdigest()
+ r = requests.get(exe_url)
+ open(exe_path, 'wb').write(r.content)
+ exe_sha256 = hashlib.sha256(r.content).hexdigest()
else:
exe_data = open(exe_path, 'rb').read()
exe_sha256 = hashlib.sha256(exe_data).hexdigest()
diff --git a/install/requirements-windows.txt b/install/requirements-windows.txt
index 32b8da4a..6e03f6e8 100644
--- a/install/requirements-windows.txt
+++ b/install/requirements-windows.txt
@@ -8,6 +8,7 @@ pefile==2017.11.5
PyInstaller==3.3.1
PyQt5==5.9.2
PySocks==1.6.7
+requests==2.19.1
sip==4.19.6
stem==1.6.0
Werkzeug==0.14.1
diff --git a/install/requirements.txt b/install/requirements.txt
index c7828080..ed83b995 100644
--- a/install/requirements.txt
+++ b/install/requirements.txt
@@ -6,6 +6,7 @@ MarkupSafe==1.0
PyInstaller==3.3.1
PyQt5==5.9.2
PySocks==1.6.7
+requests==2.19.1
sip==4.19.6
stem==1.6.0
Werkzeug==0.14.1