Skip to content

Instantly share code, notes, and snippets.

@ateoto
Created February 26, 2015 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ateoto/ba8dfda87b9967e2f109 to your computer and use it in GitHub Desktop.
Save ateoto/ba8dfda87b9967e2f109 to your computer and use it in GitHub Desktop.
import requests
import csv
from bs4 import BeautifulSoup
def is_alt_or_light(css_class):
if css_class is not None:
if css_class == 'alt':
return True
elif css_class == 'light':
return True
else
return False
else:
return False
for page_num in range(1, 11):
r = requests.get("http://www.sos.arkansas.gov/corps/search_corps.php?SEARCH=1&run={}&corp_name=%27".format(page_num))
if r.status_code == requests.codes.ok:
res = r.content
soup = BeautifulSoup(res)
cells = soup.find_all("td", class_=is_alt_or_light)
for c in cells:
print(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment