Exemplo n.º 1
0
import os 
import csv
import sys

sys.path.insert(0, '/Users/sanjain/Documents/Samvit Jain/LinkMeUp/Production and Analytics/Data Requests')

from get_class_data import returnClassData

# initialization
email_list = []

# get data from Parse
user_data = returnClassData("_User")

# populate phone_number_list
for user in user_data:

    user_email = user.get("email", None)

    if user_email is None:
    	user_email = user.get("facebook_email", None)

    if user_email is not None:
    	print user_email
        email_list.append(user_email)

print "List length: %u" % len(email_list)

# write list to text and csv files
newDir = "Emails"
Exemplo n.º 2
0
import dateutil.parser
from operator import itemgetter

import sys

sys.path.insert(0, "/Users/sanjain/Documents/Samvit Jain/LinkMeUp/Production and Analytics/Data Requests")

from get_class_data import returnClassData


# set up httplib connection to request link data
connection = httplib.HTTPSConnection("api.parse.com", 443)
connection.connect()

# get data from Parse
user_data = returnClassData("_User")
link_data = returnClassData("Link")
logs_data = returnClassData("Logs")

# initialization
user_stats_list = []

print "Number of users: %u" % len(user_data)

# create user_stats_list
for user in user_data:

    # name else username
    user_name = user.get("name", None)

    if user_name is None:
Exemplo n.º 3
0
script_dir = os.path.dirname(__file__)
file_path = os.path.join(script_dir, "last_updated.txt")

if os.path.isfile(file_path):
    with open(file_path, "r") as config_file:
        old_time = config_file.read().replace('\n', '')
        print "Old -- Pacific: %s  UTC: %s" % (get_pacific_time(old_time),
                                               old_time)

# record/print new last_updated time
new_time = datetime.datetime.utcnow().isoformat()
print "New -- Pacific: %s  UTC: %s" % (get_pacific_time(new_time), new_time)

# get data from Parse
user_data = returnClassData("_User",
                            sort_by="createdAt",
                            last_updated=old_time,
                            new_updated=new_time)
link_data = returnClassData("Link",
                            last_updated=old_time,
                            new_updated=new_time)
logs_data = returnClassData("Logs",
                            last_updated=old_time,
                            new_updated=new_time)

# exit if no data returned
if user_data is None or link_data is None or logs_data is None:
    sys.exit("Error getting Parse data from module")

# print "New user data: %s \n" % user_data
# print "New link data: %s \n" % link_data
# print "New logs data: %s \n" % logs_data
Exemplo n.º 4
0
linksUnsorted = []
linkSorted = []

candidateIdList = []
participantList = []

whiteList = ['aiuSTn5mRz', 'R5Np0HPpBH', 'iLC2RikhL3', 'xUv2Tl56dU', 'Ai2pCedWWS', 'jiflPG7Xd1', 'aftT9aLur9', 'epR9xFDRTh', 'djdZqG7osL', 'TqFUnEDiie', 'umHzK7AkTT'] 
#             supersurb,    Anand N.,     Andrew W.,    Tristan H.,   Caren B.,     Adarsh K.,    Justin B.,    akritish,     Sai G.,       Devansh K.,   Ishan N.     

blackList = ['ZRbJayScs3', 'QBjQaNUYOW', 'e4AmThaawe', '4RH2O9bjTN', 'oaluUW5QPZ', 'Ok4Jhbxqen', 'TvXEq0Bl0d', 'V71YkER7ka', 'X0qvVAfjgw', 'UNF2h9Uyg1', '7ea3cG2b80', 't8DgS2nJ0i', '0NSA1byi10', 'do1CSgzC09', 'FEoK16gQPb']
#             Samvit J.,    Ananya J.,    Sanjay J.,    Vishakha A.,  Sunny B.,     Little P.,    Alex M.,      Ishan R.,     Meg H.,       Jacob K.,     Nick W.,      Deena S.      Jihoon L.     David A. H.   Sanjay J.

start_date = datetime.datetime(2015, 7, 22, 2, 27, 00, tzinfo=pytz.utc)
# file_date = "07:23:15"

link_data = returnClassData("Link")
# with open("/Users/sanjain/Documents/Samvit Jain/LinkMeUp/Exported Parse Data/%s/Link.json" % file_date) as link_json:
#     link_data = json.load(link_json)

print "\nUnsorted links\n--------------"

for link in link_data:

    link_title = link.get('title', None)

    link_sender = link.get('sender', None)
    link_sender_id = link_sender.get('objectId', None)

    link_date_ISO = link.get('createdAt', None)
    link_datetime = dateutil.parser.parse(link_date_ISO)
Exemplo n.º 5
0
def main(argv):

   class_data = returnClassData(argv[1])

   for entry in class_data:
      print entry