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

fixed measurement saving #123

Closed
wants to merge 1 commit into from

Conversation

bogenpirat
Copy link

@bogenpirat bogenpirat commented Oct 17, 2021

this fixes #109.

the form for editing/inserting measurements requires a local field authenticity_token to be submitted in the request. the commit in this pull request queries the required value from the edit page's dom and inserts it into the request.

it thereby circumvents the authenticity_token value stored during login time which evidently does not apply to the measurement adding request and changes everytime the measurement adding page is loaded.

it seems like using this measurement adding authenticity_token doesn't invalidate the login time authenticity_token since

resp = client.set_measurements(value=50)
print(client.get_measurements())

appears to work fine. i'm guessing any POST operation requires a separate authenticity_token taken from the respective page document's form as there are already provisions for this mechanism in get_food_search_results() as well as _login().

Dnic94 added a commit to Dnic94/python-myfitnesspal that referenced this pull request Oct 22, 2021
Copy link
Contributor

@Dnic94 Dnic94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Works fine for me. 👍
Merged your changes also in my fork.
Unfortunately this Repo seems not to be actively maintained :(

@bogenpirat
Copy link
Author

given that #129 fixes a more current issue and essentially includes this PR, it supersedes this PR. thanks for the reviews!

@bogenpirat bogenpirat closed this Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

Saving measurements fails
4 participants