mirror of
https://github.com/lilydjwg/nvchecker
synced 2024-12-29 10:02:09 +00:00
parent
75873b5281
commit
587203d9ec
@ -2,7 +2,6 @@
|
|||||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import asyncio
|
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPResponse
|
from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPResponse
|
||||||
@ -18,9 +17,17 @@ except ImportError:
|
|||||||
__all__ = ['session']
|
__all__ = ['session']
|
||||||
|
|
||||||
client = AsyncHTTPClient()
|
client = AsyncHTTPClient()
|
||||||
|
HTTP2_AVAILABLE = None if pycurl else False
|
||||||
|
|
||||||
def try_use_http2(curl):
|
def try_use_http2(curl):
|
||||||
if pycurl:
|
global HTTP2_AVAILABLE
|
||||||
|
if HTTP2_AVAILABLE is None:
|
||||||
|
try:
|
||||||
|
curl.setopt(pycurl.HTTP_VERSION, 4)
|
||||||
|
HTTP2_AVAILABLE = True
|
||||||
|
except pycurl.error:
|
||||||
|
HTTP2_AVAILABLE = False
|
||||||
|
elif HTTP2_AVAILABLE:
|
||||||
curl.setopt(pycurl.HTTP_VERSION, 4)
|
curl.setopt(pycurl.HTTP_VERSION, 4)
|
||||||
|
|
||||||
class Session:
|
class Session:
|
||||||
|
Loading…
Reference in New Issue
Block a user