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

Update api.py #65

Merged
merged 1 commit into from
Jul 29, 2024
Merged

Conversation

vaibhav-2703
Copy link
Contributor

@vaibhav-2703 vaibhav-2703 commented Jul 27, 2024

Handling Invalid Location`

Changes:

  • Implemented robust validation for the get_coordinates function to handle both valid and invalid locations gracefully.
  • Enhanced error handling to ensure seamless fallback to a default location when invalid inputs are detected.

Details:
This update significantly improves the get_coordinates function in api.py by introducing comprehensive validation mechanisms. When a user provides a location, the function now checks its validity. If the location is invalid, it prints a message and gracefully falls back to a default location, thereby preventing application disruption.

Feedback Addressed:

  • Successfully passed static code analysis (CI Linter) and formatted code according to PEP8 rules using make format.
  • Integrated pre-commit hooks via make install to enforce consistent static analysis checks during commits.

Additional Context:

  • This pull request addresses feedback received on a previous attempt (Update api.py #64), which was closed due to branch deletion. The changes have been carefully revised and resubmitted to ensure compliance with project standards and requirements.

Handling invalid location - The get_coordinates function now prints a user-friendly message and defaults to the user's location if an invalid location is provided.
@ryansurf
Copy link
Owner

Hey @vaibhav-2703 ,

Great job! Just tested this in my local and it works perfectly - I like the invalid location message too.

Thanks for the detailed PR summary and nice work figuring out the linter issues. Thanks @K-dash for your help as well.

Merging now

@ryansurf ryansurf merged commit 14f4b66 into ryansurf:main Jul 29, 2024
2 checks passed
@ryansurf ryansurf mentioned this pull request Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants