How to use the aquests.protocols.http.respcodes.get function in aquests

To help you get started, we’ve selected a few aquests examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hansroh / aquests / aquests / protocols / http2 / request_handler.py View on Github external
def handle_response (self, stream_id, headers):
		# to HTTP/1.1 header
		jheaders = []
		for k, v in headers:
			k = k.decode ("utf8")
			v = v.decode ("utf8")
			if k == ":status":
				jheaders.insert (0, "HTTP/2.0 " + v + " " + respcodes.get (int (v), "Undefined Error"))
			else:
				jheaders.append (k + ": " + v)
		
		h = self.get_handler (stream_id)
		if h:
			h.collect_incoming_data ("\r\n".join (jheaders).encode ("utf8"))
			h.found_terminator ()
		# finally, make inactive on post, put request 
		self.asyncon.set_active (False)
github hansroh / aquests / aquests / client / asynconnect.py View on Github external
def handle_close (self, code = 700, msg = ""):
		if code == 0: msg = ""
		self.errcode = code
		if msg:
			self.errmsg = msg
		else:
			self.errmsg = respcodes.get (code, "Undefined Error")			
		self.close ()