This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
requests based url opener with support self supplied fingerprints | |
""" | |
debug = True | |
try: | |
import requests | |
except ImportError: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
import struct | |
####http://python-bitcoinlib.readthedocs.org/en/latest/_modules/bitcoin/core/serialize.html | |
def uint256_from_str(s): | |
"""Convert bytes to uint256""" | |
r = 0 | |
t = struct.unpack(b"<IIIIIIII", s[:32]) | |
for i in range(8): | |
r += t[i] << (i * 32) |