Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth is only needed for some URLs #34

Open
ipwnponies opened this issue May 1, 2019 · 2 comments
Open

Auth is only needed for some URLs #34

ipwnponies opened this issue May 1, 2019 · 2 comments

Comments

@ipwnponies
Copy link
Collaborator

I discovered that no auth is required for getting city or menus. Likely only for POST calls, KITCHEN_URL and RESERVATION_URL.

I suggest we whitelist the URLs (operations) that require credential. This makes cli commands to list cities or menus (#7) simpler to test and run, since it's stateless and doesn't require requests session or unnecessary logins.

@edmundmok
Copy link
Owner

edmundmok commented May 1, 2019

Yes, I think this means mealpal.get_schedules('San Francisco') doesn't help verify cookies anymore. Will need to check this again though. A better way would probably be using some kind of "get profile" API.

@ipwnponies
Copy link
Collaborator Author

Good point about the false confidence from get_schedules. I wonder what response would be returned if hitting /login with no user and password.

Thinking harder about this, we don't actually need auth, it's only when we call initialize_mealpal in execute_reserve_meal:

mealpy/mealpy/mealpy.py

Lines 206 to 208 in 5fc5bc7

# @SCHEDULER.scheduled_job('cron', hour=16, minute=59, second=58)
def execute_reserve_meal(restaurant, reservation_time, city):
mealpal = initialize_mealpal()

So I think this issue is more about cleaning up the structure of the code so that initialize_mealpal is more like "populate existing MealPal instance with cookie information". Rather than be the starting point for all commands.

Okay, I'd say this ticket is not yet actionable and may fix itself when other features (#7) make it more obvious what work needs to be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants