MCPcopy Create free account
hub / github.com/AzureAD/microsoft-authentication-library-for-python / Response

Class Response

msal/oauth2cli/http.py:41–68  ·  view source on GitHub ↗

This describes a minimal http response interface used by this package. :var int status_code: The status code of this http response. Our async code path would also accept an alias as "status". :var string text: The body of this http response. Our async code

Source from the content-addressed store, hash-verified

39
40
41class Response(object):
42 """This describes a minimal http response interface used by this package.
43
44 :var int status_code:
45 The status code of this http response.
46
47 Our async code path would also accept an alias as "status".
48
49 :var string text:
50 The body of this http response.
51
52 Our async code path would also accept an awaitable with the same name.
53 """
54 status_code = 200 # Our async code path would also accept a name as "status"
55
56 text = "body as a string" # Our async code path would also accept an awaitable
57 # We could define a json() method instead of a text property/method,
58 # but a `text` would be more generic,
59 # when downstream packages would potentially access some XML endpoints.
60
61 headers = {} # Duplicated headers are expected to be combined into one header
62 # with its value as a comma-separated string.
63 # https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.2
64 # Popular HTTP libraries model it as a case-insensitive dict.
65
66 def raise_for_status(self):
67 """Raise an exception when http response status contains error"""
68 raise NotImplementedError("Your implementation should provide this")
69
70
71def _get_status_code(resp):

Callers 2

postMethod · 0.85
getMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected