-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_latest.py
33 lines (26 loc) · 883 Bytes
/
get_latest.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
#!/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)
up_analytics.extract_latest_transactions(cur, con, header, user_id)
up_analytics.close_db(cur, con)
else:
print("user_id is invalid")
else:
print("No user_id supplied")