Comments (5)
If we need to store the user's credentials to relogin, we can store in the OS keystore using keyring package. Seems like this is the correct approach that avoids rolling our own solution.
from mealpy.
The session cookie has a TTL of 24 hours. This feature would be useful for reinvoking adhoc.
But as a scheduled task, the current logic of login every time scheduler goes off (to get fresh session cookie) would be necessary
Edit: But how does a browser keep indefinitely logged in? Maybe stale session in cookie still works to get a refreshed one, we're set. If not, we can try periodically querying site to keep session alive.
from mealpy.
From #16 (comment), a possible different solution for this issue:
There are three cookies returned on login: __cfduid, tt_visitor_id and _mealpal_session. The first two expire in 2020 (exactly 1 year from now), and the last one doesn't have an expiry. Whichever it is, it looks like we won't have to worry about cookies expiring. You can inspect MealPal(...).cookies after login to check the cookies, or use Chrome Dev tools.
We might be able to persist the cookie, in place of credentials. If we store it in config.yaml
or keyring
, this will persist for a year, for both adhoc runs and scheduled batch.
from mealpy.
The cookies are all contained in .cookies
of a MealPal
object after .login
is successful, which is of type requests.cookies.RequestsCookieJar
. Not too sure about the security aspect of this but we can just pickle
the cookie jar object to be stored as a binary file locally, and unpickle
it again when we need it. With this, I don't think we will need keyring
anymore?
from mealpy.
I agree, with persisted cookies we can avoid using keyring
altogether.
It looks to be FileCookieJar
, from stdlib, is passed to the requests
session and that is has support for serializing to disk.
from mealpy.
Related Issues (20)
- Stopped after one response 400 HOT 1
- Credentials should not be requested at module level HOT 3
- Pin requirements
- Add some tests HOT 2
- Script does not get password from keyring HOT 3
- Suggestions for improvements HOT 4
- Config not found HOT 1
- Config customization doesn't work HOT 6
- Script fails if restaurant or meal doesn't exist
- Setup travisci HOT 3
- Auth is only needed for some URLs HOT 2
- Handle reservation failure HOT 1
- Build is broken
- Limit reserving to during restaurant open hours HOT 1
- Add cli arguments HOT 1
- Update README
- List restaurants, meals, and hours from cli HOT 4
- Scheduler doesn't work HOT 3
- Support meal preference priority HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mealpy.