Python thrift.transport.TTransport.TTransportBase() Examples

The following are 1 code examples of thrift.transport.TTransport.TTransportBase(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module thrift.transport.TTransport , or try the search function .
Example #1
Source File: http_client.py    From AsyncLine with MIT License 5 votes vote down vote up
def request(self, context: FContext, payload) -> TTransportBase:
		payload = payload[4:] 
		self._payload = payload
		self._preflight_request_check(payload)
		status, text = await self._make_request(context, self._payload)
		if status == 400: 
			raise TTransportException(
				type=400, 
				message='Bad request: '+str(text) + ' :: '+ str(payload))
		elif status == 403:
			raise TTransportException(
				type=403, 
				message='Forbidden: '+str(text))
		elif status == 404:
			raise TTransportException(
				type=404,
				message='Not Found: '+str(text))
		elif status == 410:
			pass
		elif status == 500:
			raise TTransportException(
				type=500,
				message='Backend Error: '+str(text))
		elif status >= 300:
			raise TTransportException(
				type=TTransportExceptionType.UNKNOWN,
				message='request errored with {0} and message {1}'.format(
					status, str(text)
					))
		return TMemoryBuffer(text)