Skip to content

Commit

Permalink
testing basic interest comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
ianbstewart committed May 28, 2018
1 parent 4056fb2 commit 675e9b3
Show file tree
Hide file tree
Showing 4 changed files with 3,712 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/data_processing/check_interest_id_valid.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import logging
import os
import math
import sys

## suppress request INFO messages
logging.getLogger("requests").setLevel(logging.WARNING)
Expand Down Expand Up @@ -142,6 +143,8 @@ def interest_name_query_batch(access_token, user_id, interest_ids):
print('rate limit reached at id=%d, sleeping for %d seconds'%(interest_id, RATE_LIMIT_SLEEP_TIME))
sleep(RATE_LIMIT_SLEEP_TIME)
success = True
## try to restart program to dodge rate limit
# os.execl(sys.executable, sys.executable, *sys.argv)
else:
response_data = response_json['targetingsentencelines']
response_data_matches = filter(lambda x: x['content']=='People Who Match:' or x['content']=='And Must Also Match:',
Expand Down Expand Up @@ -232,7 +235,7 @@ def main():
if(len(response_names_i) < interest_names_i):
fixed_names_i = ['NA' if x not in set(response_names_i) else x for x in interest_names_i]
else:
fixed_names_i = list(interest_names_i)
fixed_names_i = list(response_names_i)
# print('%d/%d fixed names %s'%(len(response_names_i), len(interest_names_i), fixed_names_i))
## check for missing names
# if(len(response_names_i) != len(fixed_names_i) or any([name_i=='' for name_i in response_names_i])):
Expand Down
Loading

0 comments on commit 675e9b3

Please sign in to comment.