Created
March 5, 2021 16:42
-
-
Save jasonwilmot/741973aae66bd5c5b81f1131b7385f08 to your computer and use it in GitHub Desktop.
PicPack - Find Tax Exempt Homepages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#find homepages for tax exempt organizations | |
from googlesearch import search | |
from csv import reader | |
from urllib.parse import urlparse | |
with open('A50 - Museum Museum Activities.csv', 'r') as read_obj: | |
csv_reader = reader(read_obj) | |
rowCount = 0 | |
skipped = 0 | |
for row in csv_reader: | |
if rowCount > 0: | |
#run a query with the org name and its location | |
searchQuery = row[0] + " " + row[2] + " " + row[3] | |
for j in search(searchQuery, tld="co.in", num=1, stop=1 ): | |
#skip if the first result is a directory | |
if ( 'guidestar' in j or 'propublica.org' in j ): | |
skipped += 1 | |
else: | |
print(str(rowCount) + " - " + row[0] + "," + row[1] + "," + row[2] + "," + row[3] + "," + row[4] + "," + j) | |
rowCount += 1 | |
else: | |
rowCount += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment