Muhtasib noticed Requests doesn't implement logging.
Taking a closer look at urllib3 code & documentation:
intro to logging Tutorial (more detailed)
Oauth also uses logging...
Action Taken - Comment to K.R., asking if/how this should be implemented.
Starting on Requests Issue #713 (Support for Expects Http Header Bug)
Requests can check the request headers, and if it finds an "Expect" header it will wait for the 100 Continue response from the server. If it does not come, this error should flow to the caller in a way that it can distinguish a network problem from a failed expectation error.You send an Expect header, telling the server you expect a 100 (continue) response before you will send the body. If there are images or videos or some form of substantial data in the body, you don't want to send if the server will reject it anyway.
Because you are waiting for a response from the server, one request actually becomes two - a request sending the header and a request sending the body.
Dialogue goes a little something like....
Client: I want to post something. Ready?
Server: Sure! [100-continue]
Client: Here it comes! *posts*
Server: Got it! [200]
Plan of Attack
if request.headers contains Expect-header
send request with header only
wait for response
if response == 100 (continue)
send request with body
else
send request as normal
Things to consider:
- limit wait time and throw exception/error if no response
- if server prematurely closes ... don't try to send again
Testing - We want to find a website that give a 100-continue. We want to see that 100-continue. HOW? In the response header? In the response content?
No comments:
Post a Comment