Skip to content

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

Merged
merged 32 commits into from
Feb 6, 2021

Conversation

hadaskedar2020
Copy link
Contributor

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.

input_query_string = dict(key=config.ASTRONOMY_API_KEY, q=location,
dt=formatted_date)
try:
response = requests.request("GET", ASTRONOMY_URL,
Copy link
Member

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)

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

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?

Copy link
Contributor Author

@hadaskedar2020 hadaskedar2020 Feb 2, 2021

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-io
Copy link

codecov-io commented Jan 30, 2021

Codecov Report

Merging #142 (9ba6abd) into develop (60a6634) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             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              
Impacted Files Coverage Δ
app/internal/astronomy.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60a6634...9ba6abd. Read the comment docs.

@yammesicka yammesicka merged commit fdb5d87 into PythonFreeCourse:develop Feb 6, 2021
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.

3 participants