-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_all.py
34 lines (27 loc) · 953 Bytes
/
get_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
"""
************************************************************************
Finding and uploading only the most recent transactions to conserve
resources
************************************************************************
"""
__author__ = "Hamish Gunasekara"
__version__ = "1.0.0"
__email__ = "hamish.gunasekara@gmail.com"
import up_analytics
import requests
import json
import sys
from datetime import datetime, timedelta
if sys.argv:
user_id = sys.argv[1]
if user_id == 'hamish' or user_id == 'nina':
cur, con = up_analytics.connect_to_db()
header = up_analytics.connect_to_up(user_id)
transaction_params = {'page[size]': 100}
up_analytics.extract_transactions(header, cur, con, transaction_params, user_id)
up_analytics.close_db(cur, con)
else:
print("user_id is invalid")
else:
print("No user_id supplied")