Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(18)  |  Call(15)  |  Derive(0)  |  Import(3)
Convert integer to bytes

        def int2bytes(value):
	"""
	Convert integer to bytes
	"""
	return bytes(str(value), "utf-8")
        


src/d/i/dionaea-HEAD/modules/python/scripts/sip/rfc4566.py   dionaea(Download)
	from dionaea.sip.extras import int2bytes
except:
	from extras import int2bytes
 
logger = logging.getLogger('sip')
	def dumps(self):
		return b":".join([self.bwtype, int2bytes(self.bandwidth)])
 
class ConnectionData(object):
	"""
	def dumps(self):
		addr = self.connection_address
		if self.addrtype == b"IP4":
			if self.ttl != None:
				addr = addr + b"/" + int2bytes(self.ttl)
			if self.ttl != None and self.number_of_addresses != None:
				addr = addr + b"/" + int2bytes(self.number_of_addresses)
	def dumps(self):
		# ToDo: better fmt handling
		fmt = b" ".join(self.fmt)
 
		ports = int2bytes(self.port)

src/d/i/dionaea-HEAD/modules/python/scripts/sip/rfc3261.py   dionaea(Download)
except:
	import rfc2396, rfc4566
	from extras import int2bytes, ErrorWithResponse
 
logger = logging.getLogger('sip')
	def dumps(self):
		return int2bytes(self.seq) + b" " + self.method
 
	@classmethod
	def froms(cls,data):
			return self._value
		if type(self._value) == int:
			return int2bytes(self._value)
 
		return self._value.dumps()
			h.append(self.method + b" " + self.uri.dumps() + b" " + self.protocol)
		elif self.response_code != None:
			h.append(self.protocol + b" " + int2bytes(self.response_code) + b" " + self.status_message)
		else:
			return None
	def dumps(self):
		ret = b"SIP/2.0/" + self.protocol.upper() + b" " + self.address
		if self.port != None:
			ret = ret + b":" + int2bytes(self.port)
 

src/d/i/dionaea-HEAD/modules/python/scripts/sip/rfc2396.py   dionaea(Download)
	from dionaea.sip.extras import int2bytes
except:
	from extras import int2bytes
 
logger = logging.getLogger('sip')
			r = r + self.host
			if self.port:
				r = r + b":" + int2bytes(self.port)
 
		if len(self.params) > 0: