Title: Theory / Unimportant / CS / Programming / Python / Lib / requests
Tags: FromInstruction computer_to_instruction hasNotNewEffectReturnsMeaning FromVariables Variable_missing_meaning automatedNewLineAfterCommaSpace
On every note of this deck, unless a note says otherwise:
Page: http://docs.python-requests.org/en/master/user/quickstart/
Page: http://docs.python-requests.org/en/master/user/quickstart/

Instruction: requests.get(foo)
Language: Python
Returns: A response object for url foo

Variable: data
Meaning: dictionnary/list of pairs, corresponding to POST request
Context: requests.post(foo)
Language: Python
Typ: optional argument

Instruction: requests.put(
  foo,
  data=bar
)
Effect: Send a put request to url foo for data bar
Language: Python

Instruction: requests.delete(foo)
Effect: Send a delete request to url foo
Language: Python

Instruction: requests.head(foo)
Effect: Send a head request to url foo
Language: Python

Instruction: requests.options(foo)
Effect: Send a options request to url foo
Language: Python

Variable: params
Meaning: arguments sent using get protocol
Context: requests.get()
Language: Python

Variable: r.encoding
Meaning: the encoding for this response
Language: Python
Variables: r a response to a requests
Initialization: the encoding guessed by request for this response

Variable: r.content
Meaning: the content of the response as bytes
Language: Python
Variables: r a response to a requests

Variable: r.text
Meaning: the content of the response, as string, decoded using r.encoding
Language: Python
Variables: r a response to a requests

Variable: r.status_code
Meaning: The status of the response
Language: Python
Variables: r a response to a requests

Instruction: r.json()
Effect: the responses, decoded as if it were json
Language: Python
Variables: r a response to a requests

Instruction: r.rase_for_status()
Effect: Raise requests.excepttions.HTTPError, accompagnied with the status code, if an error did occur according to status code
Language: Python
Variables: r a response to a requests

Variable: r.raw
Language: Python
Variables: r a response to a requests
Value: The raw socket response from the server
Index: stream=True was written in the request getter

Instruction: r.iter_content(chunk_size=foo)
Effect: iter over the content of the response, each successive part with a size foo
Language: Python
Variables: r a response to a requests

Variable: headers
Meaning: the dictionary of headers to put before the actual http request
Context: requests.get
Language: Python

Question: In case of conflict, which authorization headers are used ?
Answer: auth=, then .netrc, then headers=
Page: http://docs.python-requests.org/en/master/user/quickstart/

Instruction: requests.post(foo)
Effect: Send a post request to url foo
Language: Python

Instruction: requests.codes.foo
Effect: the constant corresponding to http status code foo
Language: Python
Context: request.post

Variable: cookies
Meaning: the dictionnary/RequestsCookieJar of cookies to send with the request
Context: requests.get
Language: Python
Typ: optional parameter
Variables: r a responses to a request

Variable: allow_redirects
Meaning: whether redirections are allowed
Context: requests.get()
Language: Python
Typ: optional argument

Variable: timeout
Meaning: How much time to wait between two parts of the response to the request
Context: requests.get()
Language: Python
Typ: optional argument

Instruction: requests.ConnectionError
Effect: Exception for network problem
Language: Python

Instruction: requests.HTTPError
Effect: Exception for http requestes returned an unsuccessful status code
Language: Python

Instruction: requests.Timeout
Effect: Exception for failure due to timeout
Language: Python

Instruction: requests.TooManyRedirects
Effect: Exception in case of too many redirection
Language: Python

Instruction: requests.exceptions.RequestException
Effect: Parent of all exceptions explicitly raised by Requests
Language: Python