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
import sqlite3 | |
import time | |
import json | |
import urllib2 | |
def get_submissions(): | |
url="http://www.reddit.com/r/all/new/.json" #URL of the page that we want to fetch | |
headers = { 'User-Agent' : 'fetching new submissions script' } # our script "identifier" | |
req = urllib2.Request(url, None, headers) # We create new request here to open the url with above set headers | |
data = urllib2.urlopen(req).read() # Open url and make data variable equal whatever we get |