Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 26 03:44
    coddingtonbear assigned #123
  • Nov 26 03:44
    coddingtonbear assigned #126
  • Nov 25 23:29
    coddingtonbear opened #126
  • Nov 25 23:29
    coddingtonbear labeled #126
  • Nov 25 23:15
    coddingtonbear closed #116
  • Nov 25 23:15
    coddingtonbear commented #116
  • Nov 25 23:14
    coddingtonbear closed #120
  • Nov 25 23:14
    coddingtonbear commented #120
  • Nov 25 23:12
    coddingtonbear labeled #125
  • Nov 24 15:46
    coddingtonbear labeled #123
  • Nov 24 15:46
    coddingtonbear labeled #123
  • Nov 24 15:46
    coddingtonbear commented #118
  • Nov 24 15:45
    coddingtonbear labeled #118
  • Nov 24 15:45
    coddingtonbear labeled #118
  • Nov 24 15:44
    coddingtonbear commented #113
  • Nov 24 15:44
    coddingtonbear closed #113
  • Nov 24 15:43
    coddingtonbear closed #110
  • Nov 24 15:43
    coddingtonbear closed #111
  • Nov 24 15:43

    coddingtonbear on master

    add support for fiber Measureme… add support for potassium Measu… add support for kilojoules Meas… and 6 more (compare)

  • Nov 24 15:42
    coddingtonbear labeled #112
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
Redfish5
@Redfish5
Anyone showing login issues? This seemed to be working yesterday and this morning I am getting json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) off myfitnesspal\client.py", line 132, in _get_auth_data return result.json()
coddingtonbear
@coddingtonbear:matrix.org
[m]
Oh, it's definitely broken today; the login request is getting an HTTP 406; so they've probably changed something about the POST data
coddingtonbear
@coddingtonbear:matrix.org
[m]
coddingtonbear/python-myfitnesspal#115 is the issue tracking it
coddingtonbear
@coddingtonbear:matrix.org
[m]
ok; I just pushed up a (not-yet-released) fix for this to github; it looks like they might be doing some amount of user agent filtering
so I've just updated the login request to explicitly specify a user agent
Redfish5
@Redfish5
Thanks for looking into it. I suspected they changed something. It has been working flawless since I found this a few weeks ago. Thanks for the work.
coddingtonbear
@coddingtonbear:matrix.org
[m]
Fix released as 1.16.2; hopefully the folks at MFP made those changes for reasons other than intentionally locking us out
coddingtonbear
@coddingtonbear:matrix.org
[m]
Had to re-package the release (twice!) because of something mysteriously causing the wheel version of the package to be out-of-date (maybe the build directory wasn't cleared?); so it's actually fixed in 1.16.4
slps20425
@slps20425
hi, anyone knows is this support post food data into daily meal tracking record?
Geoff Bowles
@OperatorBowles
I think MFP updated their API again. I'm running into the json.decoder issue that was posted about back in February. Anyone else?
uccollab
@uccollab
Hello, I can confirm the login issue this morning, JSONDecodeError as before.
uccollab
@uccollab
Ok I noticed from the previously closed issues that someone was having troubles updating the library. Basically the version was updated but client.py was not
So I replaced the code with the one from the repo and it's working again.
Adam Coddington
@coddingtonbear
I'm sort of puzzled by this, @uccollab
I just downloaded the latest version of the library from pypi, and it does appear to have the changes I made in bb34f7291f117b3a6605b7591b8764cd38c655f6, so I'm not at all sure why you'd have to update the library manually right now
I've also tested the latest version on pypi and it works (i.e. no JSONDecodeError and I can see the day listing)
Adam Coddington
@coddingtonbear
But, I did get a couple messages this week about folks having trouble using it, so I believe you; I'm just not sure I understand what might've went wrong; can you confirm that when you asked pypi to install, that it downloaded 1.16.4? (https://pypi.org/project/myfitnesspal/1.16.4/#files)
Dustin
@dustin-codes
Hey Guys, how often can I call Client#get_date()? Is there any period between two calls I should be aware of?
1 reply
Ethan Pippin
@LePips
Hey everyone! I came across this project when I wanted to create my own iOS widgets for tracking my macros in MFP. This being in Python didn't help me directly, but I started up a mirror project in Swift at https://github.com/LePips/swift-myfitnesspal
Vikash Kothary
@VikashKothary
Hi @coddingtonbear, I wanted to start by saying great work on the library, it's so great to be able to pull my data from myfitnesspal. I had a question which might be off-topic but I see that this library using parsing to get the data. I was just wondering if you ever looking into reverse engineering the private API (I am assuming here that the mobile apps use them)? Was there a reason you didn't go down that route?
That being said, I do see the BASE_API_URL variable so have I misunderstood and that this library actually uses the REST API?
Adam Coddington
@coddingtonbear
@VikashKothary -- I hadn't actually considered what APIs the mobile apps might be using, but that's an excellent idea! Things are right now mostly relying on scraping the web UI because my original use case was pretty simple, and also relying on something as trivial as web scraping makes it at least possibly possible that somebody might be able to post a PR to fix the library were MFP to change their UI in a breaking way.
If we start using APIs that are more-difficult to introspect (I'm betting like 0.1% of folks would even know where to begin around setting up a MITM proxy), it means that more of the updating/fixing burden lands on a smaller fraction of folks
Re: this library & MFP -- it's mostly just scraping the visible web pages, but does rely on some reverse-engineered REST APIs that the web UI interacts with
Christopher Singer
@PythonAlchemist
Hi everyone! Is it possible to connect to an account that uses Facebook Authentication for MyFitnesspal? I don't see any options in the client constructor for it but I am having authentication errors if I use my facebook password as the keyword argument.
1 reply
Ayrtonalec
@Ayrtonalec
Hey, Is it possible to set a macro goal with the python api? So for example, set the myfitnesspal kcal goal to 2000 kcal per day for the logged in account.