Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 14 09:55
    iakovmarkov commented #109
  • Jan 11 20:42
    JeffWDH commented #109
  • Jan 11 20:41
    JeffWDH commented #109
  • Jan 11 20:40
    JeffWDH commented #109
  • Jan 01 14:58
    mwarrildt commented #108
  • Jan 01 14:33
    tbrooksbank commented #108
  • Jan 01 14:33
    tbrooksbank commented #108
  • Jan 01 14:32
    tbrooksbank commented #108
  • Jan 01 14:32
    tbrooksbank commented #108
  • Dec 05 2020 14:46
    Nuno111 commented #113
  • Nov 28 2020 04:33
    mvinyard commented #113
  • Nov 28 2020 04:32
    mvinyard opened #113
  • Nov 20 2020 01:27
    acrose99 edited #112
  • Nov 20 2020 01:21
    acrose99 edited #112
  • Nov 20 2020 01:20
    acrose99 edited #112
  • Nov 20 2020 01:17
    acrose99 edited #112
  • Nov 20 2020 01:17
    acrose99 opened #112
  • Nov 12 2020 17:58
    kb1900 review_requested #111
  • Nov 11 2020 19:29
    kb1900 commented #111
  • Nov 11 2020 19:15
    kb1900 commented #111
David-Wales
@David-Wales
Some example params are
Form data:
food_entry[food_id]: 917964335
food_entry[date]: 2020-02-05
food_entry[quantity]: 1.0
food_entry[weight_id]: 1128024684
food_entry[meal_id]: 1
ajax: true
I'm doing something like this
data = {'food_entry[food_id]': 917964335,'food_entry[date]' : '2020-02-05', 'food_entry[quantity]' : 1.0, 'food_entry[weight_id]' : 1128024684, 'food_entry[meal_id]' : 1, 'ajax' : 'true'}
res = client.session.post('https://www.myfitnesspal.com/food/add/', data=data)
I was following how posts are made to add weight
I also tried adding the following
data['authenticity_token'] = client._authenticity_token
Am I doing something stupid here
Not a python or a web developer but if I can get this working I'm happy to contribute back
Once again thanks for all the good work!
forgot to tag @coddingtonbear
Adam Coddington
@coddingtonbear
I'm afraid it's super hard to know given that there isn't a documented API to interact with, @David-Wales ; it's likely going to take some trial-and-error to reverse engineer interactions with that particular feature.
Adam Coddington
@coddingtonbear
but if you posted more information about what exactly went wrong, somebody might have ideas
glarnonym
@glarnonym
Hi! I'm wondering if there is a way to pull the 'Fitbit body fat %' measurement from myfitnesspal? Your wiki states "The first argument specifies the measurement name, which can be any name listed in the MyFitnessPal Check-In page" but "client.get_measurements('Fitbit body fat %')" won't work, since the measurement does not exist.
Derek
@datavistics
Is it possible to use this for adding data? Id like to add my weight programatically.
Derek
@datavistics
@coddingtonbear

Is it possible to use this for adding data? Id like to add my weight programatically.

In case Im a little unclear: My goal would be to submit data using python. Syncing would be one big benefit.

Liam Gower
@leej11
Hey just discovered this package and wondering if it's possible to post nutrition/meal activity to myfitnesspal using the API ? I searched this chat history but doesn't turn up much! Thanks in advance!
Adam Coddington
@coddingtonbear
if you don't see it in the readme, I'm afraid it's likely it doesn't exist @datavistics & @leej11
ironlion27
@ironlion27
~$ myfitnesspal store-password ironlion27
Traceback (most recent call last):
File "/home/nerio/.local/bin/myfitnesspal", line 7, in <module>
from myfitnesspal.cmdline import main
File "/home/nerio/.local/lib/python2.7/site-packages/myfitnesspal/init.py", line 1, in <module>
from myfitnesspal.client import Client # noqa
File "/home/nerio/.local/lib/python2.7/site-packages/myfitnesspal/client.py", line 7, in <module>
from measurement.measures import Energy, Weight, Volume
File "/home/nerio/.local/lib/python2.7/site-packages/measurement/measures/init.py", line 1, in <module>
from measurement.measures.distance import
File "/home/nerio/.local/lib/python2.7/site-packages/measurement/measures/distance.py", line 147
*
{
^
not sure where to go from here
rous100
@rous100
does this work to access a friend's diary?
uccollab
@uccollab
@coddingtonbear hi dude, one quick question. Do you have any concern wether scraping user data with your API for an academic experiment is legal or not?
Adam Coddington
@coddingtonbear
I'm not a lawyer, @uccollab; I'd recommend reaching out to one in any case when you are concerned you might be violating a company's terms of use.
@ironlion27 -- this library requires Python 3+; you appear to be using python 2.7
Khattak24
@Khattak24
hello sir can i find member with email using python language
Hasitha Seneviratne
@hasithas-fidenz_gitlab

Hi,
I got an error when I enter myfitnesspal store-password my_username

Traceback (most recent call last):
  File "/usr/local/bin/myfitnesspal", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3088, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3072, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 576, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 589, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 778, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'measurement<4.0,>=3.2.0' distribution was not found and is required by myfitnesspal

Could you please help ASAP?

tsatska
@tsatska
Hey peeps. Wondering if I can use this API to access food diaries from my friends on MyFitnessPal, for those who have set their diaries to be publicly visible?
tsatska
@tsatska
Nevermind but just the open issue regarding this. I'm happy to help but I'm a Python n00b unfortunately...
tsatska
@tsatska
@coddingtonbear if you give me some high-level what-to-dos, I can have a go. I've started by cloning the package repo...
tsatska
@tsatska
I actually figured out how to do it, figuring out how to push the changes to the main repo...
gjlomuti
@gjlomuti
trying to pull meal data (bfast,lunch,dinner, snack) from a given time period, would apprecaite any help
gjlomuti
@gjlomuti
@coddingtonbear
Esquared23
@Esquared23

Hi when I do something like the below

client = myfitnesspal.Client('my_username')
day = client.get_date(2013, 3, 2)
day.totals

It only returns calorie information, nothing else. Any idea on why this is not including other nutrition info like carbs, fat, protein, etc.?

Adam Coddington
@coddingtonbear
the library relies heavily on being able to scrape data from what's shown on the site's actual UI
I'd guess from what you've shown that the table the UI shows if you log-in using a browser is missing some of the columns?
I did just check what I get on my account, and it does look like the data is still being returned:
In [6]: c.get_date(2020, 11, 16).totals
Out[6]: {'calories': 871.0, 'carbohydrates': 65.0, 'fat': 37.0, 'protein': 79.0}
(you'll see that I'm sort of awful at tracking things :-|)
Adam Coddington
@coddingtonbear
@Esquared23 -^
(noticed that I forgot to ping you)
Esquared23
@Esquared23
Awesome that ended up working. If I add additional nutrients to track under "Nutrients Tracked" in settings I get additional columns in the browser and additional data returned. Looks like this is limited to Calories + 5 other nutrients though. Appreciate the help!
Justintc217
@Justintc217
Hi! I really like this library! What is the best way to get detailed nutrition information from an entry such as vitamin a and others. As far as I understand you need the food item id number but I'm not sure how to get that from an entry? Thank you so much!
coddingtonbear
@coddingtonbear:matrix.org
[m]
I'm afraid that'll be difficult to do!
In most cases, what this library does is scrape data right out of the webpage you see when you log-in to myfitnesspal
if there isn't some kind of identifier for the food item ID shown there, there isn't a way for us to figure one out
that isn't to say that there isn't such an ID in the page, though -- I'm just not aware of one being there
Justintc217
@Justintc217
@coddingtonbear:matrix.org
Thanks for the info! When doing a food item lookup does the nutritional information always assume use of the first serving size in the list of possible serving sizes? Additionally, is there a way to adjust the serving size used?
coddingtonbear
@coddingtonbear:matrix.org
[m]
I'm actually not totally sure personally; that feature was a community contribution
you might have to do a little research to find out the answer