Converting a bytearray into an integer
To decode binary data, use struct.unpack().

&gt;&gt;&gt; import struct
&gt;&gt;&gt; byte_range = bytearray(b'\x85W\xe2\xa2I')
&gt;&gt;&gt; date_header, timestamp = struct.unpack('&gt;BL', byte_range)
&gt;&gt;&gt; date_header
133
&gt;&gt;&gt; timestamp
1474470473