eggplants / get-pixivpy-token

Get your Pixiv token easily (for running upbit/pixivpy)
MIT License
117 stars 9 forks source link

Automate the refresh_token question #75

Closed sinkaroid closed 1 year ago

sinkaroid commented 1 year ago

So.. recently I developing some pixiv application, the thing is there is no documentation except from community forum upbit/pixivpy and this module.

My question is: How to automate the token refresh?

My thought is making this module into schedule or cron in every hour, then store it to somewhere like memcache or storage, so i could make it simple with pixivpy3 and call every endpoints with

api = AppPixivAPI()
api.auth(refresh_token=#GET_FROM_MY_STORAGE)

but i think it's a bit overkill tho..

Is there a simplicity the automated token refresh apart from this? thanks in advance

eggplants commented 1 year ago

Once obtained, the refresh_token can probably be used semi-permanently. If you need to refresh it, just run api.auth when it is no longer available and Pixivpy terminates the exception.

See also: https://github.com/upbit/pixivpy/issues/182#issuecomment-912705349