Skip to content

Commit 9c5680b

Browse files
committed
added signature to public functions
1 parent 51a90aa commit 9c5680b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pythonBitvavoApi/bitvavo.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,19 @@ def updateRateLimit(self, response):
177177

178178
def publicRequest(self, url):
179179
debugToConsole("REQUEST: " + url)
180-
r = requests.get(url)
180+
if(self.APIKEY != ''):
181+
now = int(time.time() * 1000)
182+
# let sig = createSignature(timestamp, method, , data)
183+
sig = createSignature(now, 'GET', url.replace(self.base, ''), {}, self.APISECRET)
184+
headers = {
185+
'Bitvavo-Access-Key': self.APIKEY,
186+
'Bitvavo-Access-Signature': sig,
187+
'Bitvavo-Access-Timestamp': str(now),
188+
'Bitvavo-Access-Window': str(self.ACCESSWINDOW)
189+
}
190+
r = requests.get(url, headers = headers)
191+
else:
192+
r = requests.get(url)
181193
if('error' in r.json()):
182194
self.updateRateLimit(r.json())
183195
else:

0 commit comments

Comments
 (0)