Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psycopg2,json,time
- from recipe import Recipe
- conn = psycopg2.connect(database="sheep", user="", password="", host="", port="5432")
- print("success")
- y = conn.cursor()
- d = []
- for i in range(2,20000):
- #while True:
- try:
- a = Recipe(i)
- a.get()
- data = a.parse()
- y.execute("INSERT INTO recipes(recipe) VALUES (%s)", (json.dumps(data),))
- conn.commit()
- print(i,' Success')
- except:
- print(i,' Failed')
- d.append(i)
- print(d)
- # continue
- # break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement