pythonhacktoberfeststeamauthenticationauthenticatorsteam-authenticatorsteam-clientsteam-guard-codessteam-websteamworksvalvewebapi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
590 B
22 lines
590 B
import requests
|
|
import gevent.monkey
|
|
gevent.monkey.patch_socket()
|
|
gevent.monkey.patch_ssl()
|
|
|
|
|
|
def make_requests_session():
|
|
"""
|
|
:returns: gevent cooperative requests session
|
|
:rtype: :class:`requests.Session`
|
|
"""
|
|
session = requests.Session()
|
|
|
|
# use urllib3 to make requests gevent cooperative
|
|
session.mount('any', requests.adapters.HTTPAdapter())
|
|
|
|
version = __import__('steam').__version__
|
|
ua = "python-steam/{0} {1}".format(version,
|
|
session.headers['User-Agent'])
|
|
session.headers['User-Agent'] = ua
|
|
|
|
return session
|
|
|