|
@@ -26,6 +26,10 @@ CHUNK_SIZE = 1024 * 10
|
|
|
|
|
|
|
|
|
def check_url(u):
|
|
|
+ """ 检测URL是否GitHub链接
|
|
|
+ :param u: URL
|
|
|
+ :return: 匹配到返回 match object,否则返回 False
|
|
|
+ """
|
|
|
for exp in (exp1, exp2, exp3, exp4, exp5):
|
|
|
m = exp.match(u)
|
|
|
if m:
|
|
@@ -92,7 +96,8 @@ def proxy(u, allow_redirects=False):
|
|
|
url = u + request.url.replace(request.base_url, '', 1)
|
|
|
if url.startswith('https:/') and not url.startswith('https://'):
|
|
|
url = 'https://' + url[7:]
|
|
|
- r = requests.request(method=request.method, url=url, data=request.data, headers=r_headers, stream=True, allow_redirects=allow_redirects)
|
|
|
+ r = requests.request(method=request.method, url=url, data=request.data,
|
|
|
+ headers=r_headers, stream=True, allow_redirects=allow_redirects)
|
|
|
headers = dict(r.headers)
|
|
|
|
|
|
|