MCPcopy Index your code
hub / github.com/python/cpython / http_open

Method http_open

Lib/test/test_urllib2.py:512–524  ·  view source on GitHub ↗
(self, req)

Source from the content-addressed store, hash-verified

510 self.requests = []
511
512 def http_open(self, req):
513 import email, copy
514 self.requests.append(copy.deepcopy(req))
515 if self._count == 0:
516 self._count = self._count + 1
517 name = http.client.responses[self.code]
518 msg = email.message_from_string(self.headers)
519 return self.parent.error(
520 "http", req, MockFile(), self.code, name, msg)
521 else:
522 self.req = req
523 msg = email.message_from_string("\r\n\r\n")
524 return MockResponse(200, "OK", msg, "", req.get_full_url())
525
526
527if hasattr(http.client, 'HTTPSConnection'):

Callers

nothing calls this directly

Calls 5

MockResponseClass · 0.85
get_full_urlMethod · 0.80
MockFileClass · 0.70
appendMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected