Browse Source

requests InsecureRequestWarning exeption catch

Ivars 7 years ago
parent
commit
1310c5169b

+ 5
- 2
playstreamproxy.py View File

@@ -18,8 +18,11 @@ from urllib import unquote, quote
18 18
 import urllib,urlparse
19 19
 #import cookielib,urllib2
20 20
 import requests
21
-from requests.packages.urllib3.exceptions import InsecureRequestWarning
22
-requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
21
+try:
22
+    from requests.packages.urllib3.exceptions import InsecureRequestWarning
23
+    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
24
+except:
25
+    pass
23 26
 
24 27
 HOST_NAME = ""
25 28
 PORT_NUMBER = 88

+ 5
- 2
resolvers/hdgo.py View File

@@ -30,8 +30,11 @@ except:
30 30
     import util
31 31
 import urllib2
32 32
 import requests
33
-from requests.packages.urllib3.exceptions import InsecureRequestWarning
34
-requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
33
+try:
34
+    from requests.packages.urllib3.exceptions import InsecureRequestWarning
35
+    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
36
+except:
37
+    pass
35 38
 #from aadecode import AADecoder
36 39
 
37 40
 if __name__ <> "__main__":

+ 5
- 2
resolvers/hqqresolver.py View File

@@ -24,8 +24,11 @@ except:
24 24
     sys.path.insert(0, os.sep.join(pp.split(os.sep)[:-1]))
25 25
     import util
26 26
 import requests
27
-from requests.packages.urllib3.exceptions import InsecureRequestWarning
28
-requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
27
+try:
28
+    from requests.packages.urllib3.exceptions import InsecureRequestWarning
29
+    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
30
+except:
31
+    pass
29 32
 
30 33
 __author__ = 'ivars777'
31 34
 if __name__ <> "__main__":

+ 5
- 2
resolvers/kapnob.py View File

@@ -29,8 +29,11 @@ except:
29 29
     sys.path.insert(0,os.sep.join(pp.split(os.sep)[:-1]))
30 30
     import util
31 31
 import requests
32
-from requests.packages.urllib3.exceptions import InsecureRequestWarning
33
-requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
32
+try:
33
+    from requests.packages.urllib3.exceptions import InsecureRequestWarning
34
+    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
35
+except:
36
+    pass
34 37
 
35 38
 __author__ = 'ivars777'
36 39
 if __name__ <> "__main__":

+ 5
- 2
resolvers/kodik.py View File

@@ -29,8 +29,11 @@ except:
29 29
     sys.path.insert(0,os.sep.join(pp.split(os.sep)[:-1]))
30 30
     import util
31 31
 import requests
32
-from requests.packages.urllib3.exceptions import InsecureRequestWarning
33
-requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
32
+try:
33
+    from requests.packages.urllib3.exceptions import InsecureRequestWarning
34
+    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
35
+except:
36
+    pass
34 37
 
35 38
 __author__ = 'ivars777'
36 39
 if __name__ <> "__main__":

+ 5
- 2
resolvers/openload3.py View File

@@ -30,8 +30,11 @@ except:
30 30
     import util
31 31
 import urllib2
32 32
 import requests
33
-from requests.packages.urllib3.exceptions import InsecureRequestWarning
34
-requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
33
+try:
34
+    from requests.packages.urllib3.exceptions import InsecureRequestWarning
35
+    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
36
+except:
37
+    pass
35 38
 #from aadecode import AADecoder
36 39
 
37 40
 __author__ = 'Jose Riha/Lubomir Kucera'

+ 5
- 2
sources/SourceBase.py View File

@@ -9,8 +9,11 @@
9 9
 import urllib2, urllib
10 10
 import datetime, re, sys,os
11 11
 import requests
12
-from requests.packages.urllib3.exceptions import InsecureRequestWarning
13
-requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
12
+try:
13
+    from requests.packages.urllib3.exceptions import InsecureRequestWarning
14
+    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
15
+except:
16
+    pass
14 17
 from collections import OrderedDict
15 18
 import ConfigParser
16 19
 try:

+ 5
- 2
sources/iplayer.py View File

@@ -487,8 +487,11 @@ Connection: Keep-Alive
487 487
     def _http_request(self, url,params = None, headers=None):
488 488
         if not headers: headers = self.headers
489 489
         import requests
490
-        from requests.packages.urllib3.exceptions import InsecureRequestWarning
491
-        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
490
+        try:
491
+            from requests.packages.urllib3.exceptions import InsecureRequestWarning
492
+            requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
493
+        except:
494
+            pass
492 495
         try:
493 496
             r = requests.get(url, headers=headers)
494 497
             return r.content

+ 5
- 2
sources/tvdom.py View File

@@ -57,8 +57,11 @@ Referer: https://tvdom.tv/
57 57
         url = "https://tvdom.tv/infinity/on_register_user"
58 58
         params = "email=%s&password=%s&remember=false&auth_type=login"%(user,password)
59 59
         import requests
60
-        from requests.packages.urllib3.exceptions import InsecureRequestWarning
61
-        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
60
+        try:
61
+            from requests.packages.urllib3.exceptions import InsecureRequestWarning
62
+            requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
63
+        except:
64
+            pass
62 65
         r = requests.post(url, data=params, headers=headers)
63 66
         js = json.loads(r.content)
64 67
         if 'success' in r.content:

+ 5
- 2
sources/viaplay.py View File

@@ -11,8 +11,11 @@ except:
11 11
     import simplejson as json
12 12
 
13 13
 import requests
14
-from requests.packages.urllib3.exceptions import InsecureRequestWarning
15
-requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
14
+try:
15
+    from requests.packages.urllib3.exceptions import InsecureRequestWarning
16
+    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
17
+except:
18
+    pass
16 19
 import urlparse, urllib
17 20
 import datetime, time,re, sys,os
18 21
 from collections import OrderedDict

+ 5
- 2
util.py View File

@@ -25,8 +25,11 @@ import datetime
25 25
 import traceback
26 26
 import cookielib
27 27
 import requests
28
-from requests.packages.urllib3.exceptions import InsecureRequestWarning
29
-requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
28
+try:
29
+    from requests.packages.urllib3.exceptions import InsecureRequestWarning
30
+    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
31
+except:
32
+    pass
30 33
 from htmlentitydefs import name2codepoint as n2cp
31 34
 import HTMLParser
32 35
 import StringIO