Skip to content

Instantly share code, notes, and snippets.

@glamp glamp/

Last active Dec 16, 2015
What would you like to do?
import psycopg2
import requests
conn = psycopg2.connect("{YOUR CONNECTION"})
cur = conn.cursor()
q = """
'' || name as url
limit 3;"""
urls = cur.fetchall()
print urls
#["'s pizza",
# ' shack',
# '']
# find the number of times pizza is mentioned in each yelp search results
for url in urls:
html = requests.get(url).text
print url, html.count("pizza")
#'s pizza 212
# shack 0
# 63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.