S3/Crypto.py now requires the requests module, which often isn't
present. Throw an error if it's not, with instructions for how to
install it.
... | ... |
@@ -13,8 +13,27 @@ from logging import debug |
13 | 13 |
|
14 | 14 |
import os |
15 | 15 |
import datetime |
16 |
-import requests |
|
17 | 16 |
import urllib |
17 |
+from ExitCodes import EX_OSFILE |
|
18 |
+ |
|
19 |
+try: |
|
20 |
+ import requests |
|
21 |
+except ImportError: |
|
22 |
+ sys.stderr.write(u""" |
|
23 |
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
24 |
+ImportError trying to import requests |
|
25 |
+Please install the python requests module: |
|
26 |
+$ sudo apt-get install python-requests |
|
27 |
+ or |
|
28 |
+$ sudo yum install python-requests |
|
29 |
+ or |
|
30 |
+$ sudo pacman -S python2-requests |
|
31 |
+ or |
|
32 |
+$ pip install requests |
|
33 |
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
34 |
+""") |
|
35 |
+ sys.stderr.flush() |
|
36 |
+ sys.exit(EX_OSFILE) |
|
18 | 37 |
|
19 | 38 |
# hashlib backported to python 2.4 / 2.5 is not compatible with hmac! |
20 | 39 |
if sys.version_info[0] == 2 and sys.version_info[1] < 6: |