PyGov的一个分支关注美国农业部营养数据库API
python-usda的Python项目详细描述
Python美国农业部
python usda是专注于USDA's Food Composition Database API的pygov分支。浏览Read the Docs上的完整文档
安装
pip install python-usda
用法
fromusda.clientimportUsdaClientclient=UsdaClient("YOUR_API_KEY")foods=client.list_foods(5)forfoodinfoods:print(food.name)
结果:
Abiyuch, raw
Acerola juice, raw
Acerola, (west indian cherry), raw
Acorn stew (Apache)
Agave, cooked (Southwest)