Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/majorika/crawlers
Browse files Browse the repository at this point in the history
Conflicts:
	committee_list/crawlers/committee_list/parser.py
  • Loading branch information
e9t committed Nov 12, 2014
2 parents 01c6f03 + 87f1c21 commit 5ffada4
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions committee_list/crawlers/committee_list/parser.py
Expand Up @@ -60,13 +60,26 @@ def parse(directory, filename, rng=None):
crawl(url % p, directory, p)

index = 0
for p in committee_codes:
n = ('%s' % filename).replace(".csv",'_%s.csv' % committee_names[index])
with open(n, 'wa') as f:
inf = '%s/%s.html' % (directory, p)
f.write('"title","political party","name","phone","email"\n')
f.write('\n'.join(get_committee_list(inf, x2)).encode('utf-8'))
f.write('\n')
index = index + 1

print 'Results written to file'

with open(filename, 'wa') as merged:
merged.write('"committe","title","political party","name","phone","email"\n')

for p in committee_codes:
n = ('%s' % filename).replace(".csv",'_%s.csv' % committee_names[index])
with open(n, 'wa') as f:
inf = '%s/%s.html' % (directory, p)
committee_list = get_committee_list(inf, x2)

merged.write((('"%s",') % committee_names[index]).encode('utf-8'))
merged.write((('\n"%s",') % committee_names[index]).join(committee_list).encode('utf-8'))
merged.write('\n')

f.write('"title","political party","name","phone","email"\n')
f.write('\n'.join(committee_list).encode('utf-8'))
f.write('\n')
print 'parsed %s' % inf

index = index + 1

merged.write('\n')
print 'Result written to ' + filename

0 comments on commit 5ffada4

Please sign in to comment.