Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - import hashlib
 - import hmac
 - import urllib2
 - import time
 - from datetime import datetime
 - #keys are obviously redacted
 - API_KEY = 'xxx'
 - API_SECRET = 'xxx'
 - def get_http(url, body=None):
 - opener = urllib2.build_opener()
 - nonce = int(time.time() * 1e6)
 - message = str(nonce) + url + ('' if body is None else body)
 - signature = hmac.new(API_SECRET, message, hashlib.sha256).hexdigest()
 - opener.addheaders = [('ACCESS_KEY', API_KEY),
 - ('ACCESS_SIGNATURE', signature),
 - ('ACCESS_NONCE', nonce)]
 - try:
 - return opener.open(urllib2.Request(url, body))
 - except urllib2.HTTPError as e:
 - print e
 - return e
 - #this resulted in a timestamped unique output, thanks to msvalkon!
 - transdata = get_http('https://coinbase.com/api/v1/transfers').read()
 - f1 = open('{}_DUMP.txt'.format(int(time.time())), 'w+')
 - f1.write( transdata )
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment