Nutritional info script
Description
Hello, I have added a new script for retrieving the nutritional facts of different food items by making a call to a free API called Calorie Ninjas.
Type of change
Type of change<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes. Help us understand your motivation by explaining why you decided to make this change. Happy Contributing! -->
Please delete options that are not relevant.
- [x] New feature (non-breaking change which adds functionality)
Checklist:
- [x] My code follows the style guidelines(Clean Code) of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have created a helpful and easy to understand
README.md - [x] My documentation follows
Template for README.md - [x] I have added the project meta data in the PR template.
- [x] I have created the
requirements.txtfile if needed.
Project Metadata
If there is no-file/nothing to fill the below fields with, then type: none
Example: If no requirements.txt needed/present, then type none in Requirments.
Category:
- [ ] Calculators
- [ ] AI/ML
- [ ] Scrappers
- [ ] Social_Media
- [ ] Image_Processing
- [ ] Video_Processing
- [ ] Games
- [ ] Networking
- [ ] OS_Utilities
- [ ] Automation
- [ ] Cryptography
- [ ] Computer_Vision
- [x] Fun
- [ ] Others
Title: <Nutrition Facts Script>
Folder: <Nutritional-Facts>
Requirements: <requests>
Script: <nutrition>
Arguments: <query>
Contributor: <AdithyaBollu>
Description: <Gets nutrition facts of your favorite food items! :)>
Summary by Sourcery
Add a new interactive nutrition information script that fetches and displays nutritional facts for foods using the CalorieNinjas API
New Features:
- Implement get_nutrition_info function to query the CalorieNinjas API and return nutrient data
- Build a CLI in nutrition.py to prompt users for food items, handle quit commands, and format output
Build:
- Include requirements.txt listing all dependencies for the nutrition script
Documentation:
- Add README with setup instructions, API key configuration, usage examples, and author information
Reviewer's Guide
This PR introduces a new command-line script that fetches and displays nutritional facts for user-entered food queries via the CalorieNinjas API, along with accompanying documentation and dependency management.
Sequence diagram for user querying nutritional facts
sequenceDiagram
actor User
participant "nutrition.py"
participant "CalorieNinjas API"
User->>"nutrition.py": Enter food query
"nutrition.py"->>"CalorieNinjas API": GET /v1/nutrition?query={food}
"CalorieNinjas API"-->>"nutrition.py": Nutrition facts response
"nutrition.py"->>User: Display nutrition facts or error message
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Implement nutrition facts CLI script with API integration |
|
Nutritional-Facts/nutrition.py |
| Add setup and usage documentation |
|
Nutritional-Facts/README.md |
| Add requirements file for dependencies |
|
Nutritional-Facts/requirements.txt |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
Hello, I am confused as to why I am failing the DeepSource: Python check even though I have documented everything pretty well.