pieceofchalk's solution to "Pipl and Spokeo Script"

my solution https://gist.github.com/pieceofchalk/2e087bbe46009cef54fc<\/a> if find more than one address, append column for each to csv row<\/p>\n\n

my google spreadsheet: https://docs.google.com/spreadsheets/d/1Bdcsom1lNBr8F7m8o8JlVFGlTL1-HyHDVUyEJiDsiOM<\/a><\/p>\n\n

output csv:<\/p>\n

Clark<\/span>,<\/span>Kent<\/span>,<\/span>1974-03-09<\/span>,<\/span>KS<\/span>,<\/span>&<\/span>quot<\/span>;<\/span>Kansas<\/span>,<\/span> <\/span>United<\/span> <\/span>States&quot<\/span>;<\/span>\nBarak<\/span>,<\/span>Obama<\/span>,<\/span>1961-08-04<\/span>,<\/span>DC<\/span>,<\/span>Ukraine<\/span>,<\/span>&<\/span>quot<\/span>;<\/span>K<\/span> <\/span>St<\/span> <\/span>Nw<\/span>,<\/span> <\/span>Washington<\/span>,<\/span> <\/span>District<\/span> <\/span>Of<\/span> <\/span>Columbia&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Nw<\/span> <\/span>K<\/span> <\/span>Street<\/span>,<\/span> <\/span>Washington<\/span>,<\/span> <\/span>District<\/span> <\/span>Of<\/span> <\/span>Columbia&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Washington<\/span> <\/span>Dc<\/span>,<\/span> <\/span>District<\/span> <\/span>Of<\/span> <\/span>Columbia&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Washington<\/span>,<\/span> <\/span>United<\/span> <\/span>States&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Yakutsk<\/span>,<\/span> <\/span>Russian<\/span> <\/span>Federation&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Chicago<\/span>,<\/span> <\/span>Illinois&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Kalifornsky<\/span>,<\/span> <\/span>Alaska&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Los<\/span> <\/span>Angeles<\/span>,<\/span> <\/span>California&quot<\/span>;,<\/span>United<\/span> <\/span>States<\/span>,<\/span>&<\/span>quot<\/span>;<\/span>Jakarta<\/span>,<\/span> <\/span>Indonesia&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Murmansk<\/span>,<\/span> <\/span>Russian<\/span> <\/span>Federation&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>461<\/span> <\/span>Dirksen<\/span> <\/span>Senate<\/span> <\/span>Office<\/span> <\/span>Building<\/span> <\/span>W<\/span>,<\/span> <\/span>Washington<\/span>,<\/span> <\/span>District<\/span> <\/span>Of<\/span> <\/span>Columbia&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Washington<\/span>,<\/span> <\/span>District<\/span> <\/span>Of<\/span> <\/span>Columbia&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Honolulu<\/span>,<\/span> <\/span>Hawaii&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>New<\/span> <\/span>York<\/span>,<\/span> <\/span>New<\/span> <\/span>York&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Illinois<\/span> <\/span>City<\/span>,<\/span> <\/span>Illinois&quot<\/span>;,<\/span>&<\/span>quot<\/span>;<\/span>Nw<\/span> <\/span>Pennsylvania<\/span> <\/span>Avenue<\/span>,<\/span> <\/span>Washington<\/span>,<\/span> <\/span>District<\/span> <\/span>Of<\/span> <\/span>Columbia&quot<\/span>;<\/span>\n<\/pre><\/div>\n

about spokeo.com I agree with @SkeletonSlayerz, "You are prohibited from scraping, crawling, data-mining, or using any robot, spider, or other automatic device to send queries to the Spokeo's servers or Spokeo.com"<\/p>\n

my solution https://gist.github.com/pieceofchalk/2e087bbe46009cef54fc if find more than one address, append column for each to csv row pipl.py #!/usr/bin/env python from piplapis.search import SearchAPIRequest from piplapis.data import Person from piplapis.data.fields import Address, Name, DOB import gspread from datetime import datetime import csv google_account = 'your_account@gmail.com' google_password = 'your_app_password' # if you have 2-step verification, generate app password api_key = 'sample_key' # pipl api key output_file = 'output.csv' # name of output csv def write_to_csv(row): with open(output_file, 'a') as f: writer = csv.writer(f) writer.writerow(row) def pipl(row): fields = [Name(first=row[0], last=row[1]), DOB.from_birth_date(datetime.strptime(row[2], '%Y-%m-%d').date()), Address(country='US', state=row[3])] request = SearchAPIRequest(api_key=api_key, person=Person(fields=fields)) response = request.send() return response def proccess(): gc = gspread.login(google_account, google_password) wks = gc.open("pipl").sheet1 wks_list = wks.get_all_values() for row in wks_list: search = pipl(row) if search.person: for address in search.person.addresses: row.append(address._display) write_to_csv(row) elif search.possible_persons: adress_list = [] for person in search.possible_persons: adress_list += [address._display for address in person.addresses] adress_list = set(adress_list) row += list(adress_list) write_to_csv(row) if __name__ == '__main__': proccess() my google spreadsheet: https://docs.google.com/spreadsheets/d/1Bdcsom1lNBr8F7m8o8JlVFGlTL1-HyHDVUyEJiDsiOM output csv: Clark,Kent,1974-03-09,KS,"Kansas, United States" Barak,Obama,1961-08-04,DC,Ukraine,"K St Nw, Washington, District Of Columbia","Nw K Street, Washington, District Of Columbia","Washington Dc, District Of Columbia","Washington, United States","Yakutsk, Russian Federation","Chicago, Illinois","Kalifornsky, Alaska","Los Angeles, California",United States,"Jakarta, Indonesia","Murmansk, Russian Federation","461 Dirksen Senate Office Building W, Washington, District Of Columbia","Washington, District Of Columbia","Honolulu, Hawaii","New York, New York","Illinois City, Illinois","Nw Pennsylvania Avenue, Washington, District Of Columbia" about spokeo.com I agree with @SkeletonSlayerz, "You are prohibited from scraping, crawling, data-mining, or using any robot, spider, or other automatic device to send queries to the Spokeo's servers or Spokeo.com"
my solution https://gist.github.com/pieceofchalk/2e087bbe46009cef54fc if find more than one address, append column for each to csv row python pipl api library: git clone https://github.com/piplcom/piplapis-python.git or wget https://github.com/piplcom/piplapis-python/archive/master.zip cd piplapis-python sudo python setup.py install google spreadsheet lib : pip install gspread or git clone https://github.com/burnash/gspread.git cd gspread python setup.py install solution script: pipl.py #!/usr/bin/env python from piplapis.search import SearchAPIRequest from piplapis.data import Person from piplapis.data.fields import Address, Name, DOB import gspread from datetime import datetime import csv google_account = 'your_account@gmail.com' google_password = 'your_app_password' # if you have 2-step verification, generate app password api_key = 'sample_key' # pipl api key output_file = 'output.csv' # name of output csv def write_to_csv(row): with open(output_file, 'a') as f: writer = csv.writer(f) writer.writerow(row) def pipl(row): fields = [Name(first=row[0], last=row[1]), DOB.from_birth_date(datetime.strptime(row[2], '%Y-%m-%d').date()), Address(country='US', state=row[3])] request = SearchAPIRequest(api_key=api_key, person=Person(fields=fields)) response = request.send() return response def proccess(): gc = gspread.login(google_account, google_password) wks = gc.open("pipl").sheet1 wks_list = wks.get_all_values() for row in wks_list: search = pipl(row) if search.person: for address in search.person.addresses: row.append(address._display) write_to_csv(row) elif search.possible_persons: adress_list = [] for person in search.possible_persons: adress_list += [address._display for address in person.addresses] adress_list = set(adress_list) row += list(adress_list) write_to_csv(row) if __name__ == '__main__': proccess() my google spreadsheet: https://docs.google.com/spreadsheets/d/1Bdcsom1lNBr8F7m8o8JlVFGlTL1-HyHDVUyEJiDsiOM output csv: Clark,Kent,1974-03-09,KS,"Kansas, United States" Barak,Obama,1961-08-04,DC,Ukraine,"K St Nw, Washington, District Of Columbia","Nw K Street, Washington, District Of Columbia","Washington Dc, District Of Columbia","Washington, United States","Yakutsk, Russian Federation","Chicago, Illinois","Kalifornsky, Alaska","Los Angeles, California",United States,"Jakarta, Indonesia","Murmansk, Russian Federation","461 Dirksen Senate Office Building W, Washington, District Of Columbia","Washington, District Of Columbia","Honolulu, Hawaii","New York, New York","Illinois City, Illinois","Nw Pennsylvania Avenue, Washington, District Of Columbia" about spokeo.com I agree with @SkeletonSlayerz, "You are prohibited from scraping, crawling, data-mining, or using any robot, spider, or other automatic device to send queries to the Spokeo's servers or Spokeo.com"
my solution https://gist.github.com/pieceofchalk/2e087bbe46009cef54fc if find more than one address, append column for each to csv row python pipl api library: git clone https://github.com/piplcom/piplapis-python.git or wget https://github.com/piplcom/piplapis-python/archive/master.zip cd piplapis-python sudo python setup.py install google spreadsheet lib : pip install gspread or git clone https://github.com/burnash/gspread.git cd gspread python setup.py install solution script: pipl.py #!/usr/bin/env python from piplapis.search import SearchAPIRequest from piplapis.data import Person from piplapis.data.fields import Address, Name, DOB import gspread from datetime import datetime import csv import json from oauth2client.client import SignedJwtAssertionCredentials google_account = 'your_account@gmail.com' api_key = 'sample_key' # pipl api key output_file = 'output.csv' def write_to_csv(row): with open(output_file, 'a') as f: writer = csv.writer(f) writer.writerow(row) def pipl(row): fields = [Name(first=row[0], last=row[1]), DOB.from_birth_date(datetime.strptime(row[2], '%Y-%m-%d').date()), Address(country='US', state=row[3])] request = SearchAPIRequest(api_key=api_key, person=Person(fields=fields)) response = request.send() return response def proccess(gc): wks = gc.open("pipl").sheet1 wks_list = wks.get_all_values() for row in wks_list: search = pipl(row) if search.person: for address in search.person.addresses: row.append(address._display) write_to_csv(row) elif search.possible_persons: adress_list = [] for person in search.possible_persons: adress_list += [address._display for address in person.addresses] adress_list = set(adress_list) row += list(adress_list) write_to_csv(row) if __name__ == '__main__': import argparse parser = argparse.ArgumentParser() parser.add_argument('--json-key', type=str, default=False, help='OAuth2') parser.add_argument('--passwd', type=str, default=False, help='if you have 2-step verification, generate app password') args = parser.parse_args() if args.json_key: json_key = json.load(open(args.json_key)) scope = ['https://spreadsheets.google.com/feeds'] credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], scope) gc = gspread.authorize(credentials) elif args.passwd: gc = gspread.login(google_account, google_password = 'your_app_password' # if you have 2-step verification, generate app password api_key = 'sample_key' # pipl api key output_file = 'output.csv' # name of output csv def write_to_csv(row): with open(output_file, 'a') as f: writer = csv.writer(f) writer.writerow(row) def pipl(row): fields = [Name(first=row[0], last=row[1]), DOB.from_birth_date(datetime.strptime(row[2], '%Y-%m-%d').date()), Address(country='US', state=row[3])] request = SearchAPIRequest(api_key=api_key, person=Person(fields=fields)) response = request.send() return response def proccess(): gc = gspread.login(google_account, google_password) wks = gc.open("pipl").sheet1 wks_list = wks.get_all_values() for row in wks_listelse: search = pipl(row) ifraise searchException('need json_key for OAuth2 or password if you have 2-step verification') proccess(gc) my google spreadsheet: https://docs.person: for address in search.person.addresses: row.append(address._display) write_to_csv(row) elif search.possible_persons: adress_list = [] for person in search.possible_persons: adress_list += [address._display for address in person.addresses] adress_list = set(adress_list) row += list(adress_list) write_to_csv(row) if __name__ == '__main__': proccess() my google spreadsheet: https://docs.google.com/spreadsheets/d/1Bdcsom1lNBr8F7m8o8JlVFGlTL1-HyHDVUyEJiDsiOM output csv: Clark,Kent,1974-03-09,KS,"Kansas, United States" Barak,Obama,1961-08-04,DC,Ukraine,"K St Nw, Washington, District Of Columbia","Nw K Street, Washington, District Of Columbia","Washington Dc, District Of Columbia","Washington, United States","Yakutsk, Russian Federation","Chicago, Illinois","Kalifornsky, Alaska","Los Angeles, California",United States,"Jakarta, Indonesia","Murmansk, Russian Federation","461 Dirksen Senate Office Building W, Washington, District Of Columbia","Washington, District Of Columbia","Honolulu, Hawaii","New York, New York","Illinois City, Illinois","Nw Pennsylvania Avenue, Washington, District Of Columbia" about spokeo.com I agree with @SkeletonSlayerz, "You are prohibited from scraping, crawling, data-mining, or using any robot, spider, or other automatic device to send queries to the Spokeo's servers or Spokeo.com" "

User: pieceofchalk

Question: Pipl and Spokeo Script

Back to question