docs: some more docs
parent
d11e89591a
commit
7b7dbb3ee2
|
@ -34,6 +34,19 @@ def setup(func):
|
||||||
referer: str = None,
|
referer: str = None,
|
||||||
headers=None,
|
headers=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
|
'''
|
||||||
|
{0} performs a {0} request
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
url : str
|
||||||
|
url is the url of the request to be performed
|
||||||
|
cf : bool
|
||||||
|
cf if True performs the request through cfscrape.
|
||||||
|
For cloudflare protected sites.
|
||||||
|
referer : str
|
||||||
|
a url sent as referer in request headers
|
||||||
|
'''
|
||||||
sess = cf_session if cf else req_session
|
sess = cf_session if cf else req_session
|
||||||
if headers:
|
if headers:
|
||||||
default_headers.update(headers)
|
default_headers.update(headers)
|
||||||
|
@ -55,6 +68,7 @@ def setup(func):
|
||||||
if logger.getEffectiveLevel() == logging.DEBUG:
|
if logger.getEffectiveLevel() == logging.DEBUG:
|
||||||
_log_response_body(res)
|
_log_response_body(res)
|
||||||
return res
|
return res
|
||||||
|
setup_func.__doc__ = setup_func.__doc__.format(func.__name__)
|
||||||
return setup_func
|
return setup_func
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,6 +80,16 @@ def get(url: str,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
'''
|
'''
|
||||||
get performs a get request
|
get performs a get request
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
url : str
|
||||||
|
url is the url of the request to be performed
|
||||||
|
cf : bool
|
||||||
|
cf if True performs the request through cfscrape.
|
||||||
|
For cloudflare protected sites.
|
||||||
|
referer : str
|
||||||
|
a url sent as referer in request headers
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +100,17 @@ def post(url: str,
|
||||||
headers=None,
|
headers=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
'''
|
'''
|
||||||
get performs a get request
|
post performs a post request
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
url : str
|
||||||
|
url is the url of the request to be performed
|
||||||
|
cf : bool
|
||||||
|
cf if True performs the request through cfscrape.
|
||||||
|
For cloudflare protected sites.
|
||||||
|
referer : str
|
||||||
|
a url sent as referer in request headers
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,4 +8,9 @@ Each of the site (in the tool) can roughly be classfied into two.
|
||||||
- Sites which don't use cloudflare DDoS protection. Ex: :py:class:`~anime_downloader.sites.nineanime.NineAnime`
|
- Sites which don't use cloudflare DDoS protection. Ex: :py:class:`~anime_downloader.sites.nineanime.NineAnime`
|
||||||
- Sites which use cloudflare DDoS protection. Ex: :py:class:`~anime_downloader.sites.kissanime.KissAnime`
|
- Sites which use cloudflare DDoS protection. Ex: :py:class:`~anime_downloader.sites.kissanime.KissAnime`
|
||||||
|
|
||||||
Sites which use cloudflare have the base class :py:class:`~anime_downloader.sites.anime.BaseAnime`. Sites which don't have the base class :py:class:`~anime_downloader.sites.baseanimecf.BaseAnimeCF`.
|
All sites have the base class :py:class:`~anime_downloader.sites.anime.Anime`.
|
||||||
|
There are helper functions defined :py:func:`anime_downloader.sites.helpers.request.get` and :py:func:`anime_downloader.sites.helpers.request.post`.
|
||||||
|
You are expected to use these functions to perform any network requests.
|
||||||
|
There is also a helper function :py:func:`anime_downloader.sites.helpers.request.soupfiy` for making `BeautifulSoup` s out of requests.
|
||||||
|
|
||||||
|
All requests are cached. So don't worry about making requests twice.
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
Helper functions
|
||||||
|
****************
|
||||||
|
|
||||||
|
.. automodule:: anime_downloader.sites.helpers.request
|
||||||
|
:members:
|
||||||
|
|
||||||
|
|
|
@ -42,4 +42,5 @@ NOTE: To download from sites marked `[cloudflare]`, anime-downloader has to be i
|
||||||
usage/watch
|
usage/watch
|
||||||
usage/config
|
usage/config
|
||||||
advanced/custom_site
|
advanced/custom_site
|
||||||
api/anime.rst
|
api/base_classes.rst
|
||||||
|
api/helper_functions.rst
|
||||||
|
|
Loading…
Reference in New Issue