MCPcopy
hub / github.com/JustAnotherArchivist/snscrape / _requests_response_repr

Function _requests_response_repr

snscrape/_cli.py:64–81  ·  view source on GitHub ↗
(name, response, withHistory = True)

Source from the content-addressed store, hash-verified

62
63
64def _requests_response_repr(name, response, withHistory = True):
65 ret = []
66 ret.append(f'{name} = {response!r}')
67 ret.append(f'\n {name}.url = {response.url}')
68 ret.append(f'\n {name}.request = ')
69 ret.append(_repr('_', response.request).replace('\n', '\n '))
70 if withHistory and response.history:
71 ret.append(f'\n {name}.history = [')
72 for previousResponse in response.history:
73 ret.append('\n ')
74 ret.append(_requests_response_repr('_', previousResponse, withHistory = False).replace('\n', '\n '))
75 ret.append('\n ]')
76 ret.append(f'\n {name}.status_code = {response.status_code}')
77 ret.append(f'\n {name}.headers = \\')
78 for field in response.headers:
79 ret.append(f'\n {field} = {_repr("_", response.headers[field])}')
80 ret.append(f'\n {name}.content = {_repr("_", response.content)}')
81 return ''.join(ret)
82
83
84def _requests_exception_repr(name, exc):

Callers 1

_reprFunction · 0.85

Calls 1

_reprFunction · 0.85

Tested by

no test coverage detected