Skip to content

Commit f4a4147

Browse files
committed
disable certificate verification for python < 2.7.9, sni/ssl
1 parent b5ece74 commit f4a4147

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

resources/lib/twitch/scraper.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- encoding: utf-8 -*-
2+
import sys
23
import requests
34
# import six
45
from six.moves.urllib.error import URLError
@@ -15,6 +16,10 @@
1516
except:
1617
import simplejson as json # @UnresolvedImport
1718

19+
SSL_VERIFICATION = True
20+
if sys.version_info <= (2, 7, 9):
21+
SSL_VERIFICATION = False
22+
1823
MAX_RETRIES = 5
1924

2025

@@ -51,7 +56,7 @@ def download(baseurl, parameters={}, headers={}, data={}, method=methods.GET):
5156
for _ in range(MAX_RETRIES):
5257
try:
5358
headers.update({USER_AGENT: USER_AGENT_STRING})
54-
response = requests.request(method=method, url=url, headers=headers, data=data)
59+
response = requests.request(method=method, url=url, headers=headers, data=data, verify=SSL_VERIFICATION)
5560
content = response.content
5661
if not content:
5762
content = '{"status": %d}' % response.status_code

0 commit comments

Comments
 (0)