MCPcopy
hub / github.com/cherrypy/cherrypy / request

Method request

cherrypy/test/test_session.py:260–277  ·  view source on GitHub ↗
(index)

Source from the content-addressed store, hash-verified

258 errors = []
259
260 def request(index):
261 if self.scheme == 'https':
262 c = HTTPSConnection('%s:%s' % (self.interface(), self.PORT))
263 else:
264 c = HTTPConnection('%s:%s' % (self.interface(), self.PORT))
265 for i in range(request_count):
266 c.putrequest('GET', '/')
267 for k, v in cookies:
268 c.putheader(k, v)
269 c.endheaders()
270 response = c.getresponse()
271 body = response.read()
272 if response.status != 200 or not body.isdigit():
273 errors.append((response.status, body))
274 else:
275 data_dict[index] = max(data_dict[index], int(body))
276 # Uncomment the following line to prove threads overlap.
277 # sys.stdout.write("%d " % index)
278
279 # Start <request_count> requests from each of
280 # <client_thread_count> concurrent clients

Calls 1

readMethod · 0.45

Tested by

no test coverage detected