adjust cache maxage values

pull/197/head
Mike Fährmann 6 years ago
parent f612284d24
commit a2af2d2965
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -665,7 +665,7 @@ class DeviantartAPI():
"""Authenticate the application by requesting an access token"""
self.headers["Authorization"] = self._authenticate_impl(refresh_token)
@cache(maxage=3590, keyarg=1)
@cache(maxage=3600, keyarg=1)
def _authenticate_impl(self, refresh_token):
"""Actual authenticate implementation"""
url = "https://www.deviantart.com/oauth2/token"
@ -748,7 +748,7 @@ class DeviantartAPI():
return result
@cache(maxage=365*24*60*60, keyarg=0)
@cache(maxage=10*365*24*3600, keyarg=0)
def _refresh_token_cache(original_token, new_token=None):
return new_token or original_token

@ -72,7 +72,7 @@ class ExhentaiExtractor(Extractor):
self.limits = False
self.session.cookies["nw"] = "1"
@cache(maxage=90*24*60*60, keyarg=1)
@cache(maxage=90*24*3600, keyarg=1)
def _login_impl(self, username, password):
self.log.info("Logging in as %s", username)
url = "https://forums.e-hentai.org/index.php?act=Login&CODE=01"

@ -163,7 +163,7 @@ class ImagetwistImageExtractor(ImagehostImageExtractor):
params = None
@property
@memcache(maxage=3*60*60)
@memcache(maxage=3*3600)
def cookies(self):
return self.request(self.page_url).cookies

@ -25,7 +25,7 @@ class LusciousExtractor(Extractor):
if username:
self._update_cookies(self._login_impl(username, password))
@cache(maxage=14*24*60*60, keyarg=1)
@cache(maxage=14*24*3600, keyarg=1)
def _login_impl(self, username, password):
self.log.info("Logging in as %s", username)
url = "https://members.luscious.net/accounts/login/"

@ -10,6 +10,7 @@
from .common import Extractor, Message
from .. import text, util
from ..cache import memcache
class MangadexExtractor(Extractor):
@ -30,12 +31,11 @@ class MangadexExtractor(Extractor):
url = "{}/api/chapter/{}".format(self.root, chapter_id)
return self.request(url).json()
def manga_data(self, manga_id, *, cache={}):
@memcache(keyarg=1)
def manga_data(self, manga_id):
"""Request API results for 'manga_id'"""
if manga_id not in cache:
url = "{}/api/manga/{}".format(self.root, manga_id)
cache[manga_id] = self.request(url).json()
return cache[manga_id]
return self.request(url).json()
class MangadexChapterExtractor(MangadexExtractor):

@ -90,7 +90,7 @@ class NijieExtractor(AsynchronousMixin, Extractor):
username, password = self._get_auth_info()
self._update_cookies(self._login_impl(username, password))
@cache(maxage=150*24*60*60, keyarg=1)
@cache(maxage=150*24*3600, keyarg=1)
def _login_impl(self, username, password):
self.log.info("Logging in as %s", username)
url = "{}/login_int.php".format(self.root)

@ -283,7 +283,7 @@ class OAuthMastodon(OAuthBase):
message_template=MASTODON_MSG_TEMPLATE,
)
@cache(maxage=10*365*24*60*60, keyarg=1)
@cache(maxage=10*365*24*3600, keyarg=1)
def _register(self, instance):
self.log.info("Registering application for '%s'", instance)

@ -423,7 +423,7 @@ class PixivAppAPI():
self.user, auth = self._login_impl(self.username, self.password)
self.extractor.session.headers["Authorization"] = auth
@cache(maxage=3590, keyarg=1)
@cache(maxage=3600, keyarg=1)
def _login_impl(self, username, password):
url = "https://oauth.secure.pixiv.net/auth/token"
data = {
@ -511,6 +511,6 @@ class PixivAppAPI():
params = text.parse_query(query)
@cache(maxage=365*24*60*60, keyarg=0)
@cache(maxage=10*365*24*3600, keyarg=0)
def _refresh_token_cache(username):
return None

@ -211,7 +211,7 @@ class RedditAPI():
access_token = self._authenticate_impl(self.refresh_token)
self.extractor.session.headers["Authorization"] = access_token
@cache(maxage=3590, keyarg=1)
@cache(maxage=3600, keyarg=1)
def _authenticate_impl(self, refresh_token=None):
"""Actual authenticate implementation"""
url = "https://www.reddit.com/api/v1/access_token"

@ -123,7 +123,7 @@ class SankakuExtractor(SharedConfigMixin, Extractor):
else:
self.logged_in = False
@cache(maxage=90*24*60*60, keyarg=1)
@cache(maxage=90*24*3600, keyarg=1)
def _login_impl(self, usertuple, password):
username = usertuple[0]
self.log.info("Logging in as %s", username)

@ -54,7 +54,7 @@ class SeigaExtractor(Extractor):
username, password = self._get_auth_info()
self._update_cookies(self._login_impl(username, password))
@cache(maxage=7*24*60*60, keyarg=1)
@cache(maxage=7*24*3600, keyarg=1)
def _login_impl(self, username, password):
self.log.info("Logging in as %s", username)
url = "https://account.nicovideo.jp/api/v1/login"

@ -27,7 +27,7 @@ class TsuminoBase():
self.session.cookies.setdefault(
"ASP.NET_SessionId", "x1drgggilez4cpkttneukrc5")
@cache(maxage=14*24*60*60, keyarg=1)
@cache(maxage=14*24*3600, keyarg=1)
def _login_impl(self, username, password):
self.log.info("Logging in as %s", username)
url = "{}/Account/Login".format(self.root)

@ -25,7 +25,7 @@ class WallhavenExtractor(Extractor):
if username:
self._update_cookies(self._login_impl(username, password))
@cache(maxage=365*24*60*60, keyarg=1)
@cache(maxage=365*24*3600, keyarg=1)
def _login_impl(self, username, password):
self.log.info("Logging in as %s", username)
url = "{}/auth/login".format(self.root)

Loading…
Cancel
Save