7 apiurl
= 'https://bliep-main.bliep.nl/api';
9 r
= requests
.post('{}/authenticate'.format(apiurl
), json
={
11 "mart@martlubbers.net",
14 "HIER JE WACHWOORD INVOEREN",
16 "393977lIRGDPPGSNt2z5Hhj7VdLu0GEDh7pCKC64Jht2id5TyBNr7DSJjGS7jIAF"})
17 token
= 'Bearer {}'.format(r
.json()['access_token'])
19 '{}/profile/credit/history'.format(apiurl
),
20 params
={'limit': '200', 'offset': '0'},
21 headers
={'Authorization': token
})
24 cnx
= mysql
.connector
.connect(
25 user
='bliep', password
='bliep123', host
='localhost', database
='bliep')
26 except mysql
.connector
.Error
as err
:
30 for i
in r
.json()['data']['items']:
31 q
= "INSERT IGNORE INTO data (amount, date, description, uid) "\
32 "VALUES (%s, FROM_UNIXTIME(%s), %s, %s)"
33 amount
= int(float(i
['amount'])*100)
34 date
= int(i
['date']/1000)
35 res
= cursor
.execute(q
, (
39 int(str(date
)+str(abs(amount
)))))