-
Notifications
You must be signed in to change notification settings - Fork 52
Feature/astronomy #142
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
Feature/astronomy #142
Conversation
…into feature/astronomy
app/internal/astronomy.py
Outdated
input_query_string = dict(key=config.ASTRONOMY_API_KEY, q=location, | ||
dt=formatted_date) | ||
try: | ||
response = requests.request("GET", ASTRONOMY_URL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to work with async library (like httpx)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed to asyncio and the code runs fine from the main program,
But the test checks (which runs perfectly on my computer) just fails here:
https://github.com/PythonFreeCourse/calendar/pull/142/checks?check_run_id=1799100569
Couldn't find and information regarding to what causes the problem...
Any advice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's because you mock using responses
which is more suitable to requests
than to httpx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. You're right of course. Now I've changed it and it seems that my tests are fine and yet, there is an error in: tests/test_whatsapp.py::test_end_to_end_testing ERROR
https://github.com/PythonFreeCourse/calendar/pull/142/checks?check_run_id=1809067309
I've no idea on how my code could impact that...
Can you take a look again please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it some caveats in the work with async frameworks.
Can you please return get_data_from_api(formatted_date, location)
instead of putting it in a async loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I use async and httpx I think have to perform the loop - is there another way? or maybe you wanted me not to use async and httpx at all?
I've tried to do it prior to the return command, but still the whatsapp test fails...
Codecov Report
@@ Coverage Diff @@
## develop #142 +/- ##
===========================================
+ Coverage 99.38% 99.39% +0.01%
===========================================
Files 37 38 +1
Lines 1456 1489 +33
===========================================
+ Hits 1447 1480 +33
Misses 9 9
Continue to review full report at Codecov.
|
…into feature/astronomy
…into feature/astronomy
…astronomy # Conflicts: # requirements.txt
…into feature/astronomy
…into feature/astronomy
This feature gets astronomical data for given date & location.
It returns the following:
Status - success / failure (+ ErrorDescription).
Location - relevant location values: name, region, country, lat, lon etc.
Astronomical data in local time: sunrise, sunset, moonrise, moonset, moon_phase, moon_illumination.