Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

fixup async/await example after module rename #168 #213 #230

Merged
merged 1 commit into from
Jul 16, 2020

Conversation

shuckc
Copy link
Contributor

@shuckc shuckc commented Jul 16, 2020

I noticed that the 'async/await example' in README no longer worked after the changes discussed in #168 were made in #213.
The module rename should be straightforward. However I also found that the return value of await r.read() was b'' ie. no longer included the data received in the first exchange, which was a bit concerning. I changed the example to just read the data property, which works at least for small responses.

Perhaps awaiting read() is still required - and it is a bug that the prior data is not included in the return value, but I am not sure enough to open that as an issue.

@codecov
Copy link

codecov bot commented Jul 16, 2020

Codecov Report

Merging #230 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #230   +/-   ##
=======================================
  Coverage   98.81%   98.81%           
=======================================
  Files          22       22           
  Lines        3204     3204           
=======================================
  Hits         3166     3166           
  Misses         38       38           

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The behavior you're seeing is expected and the same as what urllib3 does: without preload_content=False, the response is already read, so reading more data returns "".

Your change is correct, merging.

@pquentin pquentin merged commit 1323e61 into python-trio:master Jul 16, 2020
@pquentin
Copy link
Member

Would you be interested in helping us improving hip? We need, among other things, to migrate tests from sync to async, which is a great way to start. If you're interested, I can give more detailed instruction. :)

@shuckc
Copy link
Contributor Author

shuckc commented Jul 16, 2020

Possibly - I'll keep working through the code and issue tracker to follow along. I joined the chat, and have followed trio for over a year or so. Other than rolling HTTP Basic auth and json= equivalents seems to work well so far.

@pquentin
Copy link
Member

Do you mean that HTTP Basic Auth and json= are missing but the rest is working well so far? Are you using hip with Trio?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants