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 requests | |
# Doesn't currently do signature checking, we'll implement that in soon. | |
URL = "https://dice64.com" | |
def dsha256(input): | |
return hashlib.sha256(hashlib.sha256(input.decode('hex')).digest()).hexdigest() |
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
from requests.auth import AuthBase | |
class Dice64Auth(AuthBase): | |
def __init__(self, userid, sign_key): | |
self.userid = userid | |
self.sign_key = sign_key | |
def __call__(self, r): | |
r.headers['Authorization'] = "BTC %d:%s" % (self.userid, self.get_signature(r)) |