Version
This commit is contained in:
parent
2c18faefe5
commit
8f678c341f
|
@ -1,4 +1,6 @@
|
||||||
'''Utility module for setting up ratelimiting on third-party sessions.'''
|
"""Utility module for setting up ratelimiting on third-party sessions."""
|
||||||
|
|
||||||
|
from _version import __version__
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -13,13 +15,15 @@ except ImportError:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup_limiter(session: requests.Session, url_prefix: str, **limiter_args): requests.Session:
|
def setup_limiter(
|
||||||
'''
|
session: requests.Session, url_prefix: str, **limiter_args
|
||||||
|
) -> requests.Session:
|
||||||
|
"""
|
||||||
Initializes limiter on session for the given domain with the given
|
Initializes limiter on session for the given domain with the given
|
||||||
settings.
|
settings.
|
||||||
|
|
||||||
Will always return the given session itself.
|
Will always return the given session itself.
|
||||||
'''
|
"""
|
||||||
if requests_ratelimiter:
|
if requests_ratelimiter:
|
||||||
session.mount(url_prefix, requests_ratelimiter.LimiterAdapter(**limiter_args))
|
session.mount(url_prefix, requests_ratelimiter.LimiterAdapter(**limiter_args))
|
||||||
return session
|
return session
|
||||||
|
|
1
requests_util/_version.py
Normal file
1
requests_util/_version.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
__version__ = '0.1.0'
|
2
setup.py
2
setup.py
|
@ -13,12 +13,14 @@ with open(PACKAGE_NAME+'/_version.py', 'r') as f:
|
||||||
version = match.group(2)
|
version = match.group(2)
|
||||||
del match, text
|
del match, text
|
||||||
|
|
||||||
|
|
||||||
def get_short_description(readme: str):
|
def get_short_description(readme: str):
|
||||||
readme = re.sub(r'#+[^\n]*\n+', '', readme)
|
readme = re.sub(r'#+[^\n]*\n+', '', readme)
|
||||||
m = re.search(r'^\s*(\w+[\w\s,]+\.)', readme)
|
m = re.search(r'^\s*(\w+[\w\s,]+\.)', readme)
|
||||||
readme = m.group(1)
|
readme = m.group(1)
|
||||||
return readme
|
return readme
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name=PACKAGE_NAME,
|
name=PACKAGE_NAME,
|
||||||
version=version,
|
version=version,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user