I would like your advice/help on this:
Create a python script that:
Add the data collected from the website into a new line of the CSV file.
Rules:
Do you have some advice? :(
I appreciate your help on this.
I tried this :
import urllib2
import cookielib
cookieJar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookieJar))
setURL = 'http://www.wunderground.com/global/stations/54511.html?MR=1'
request = urllib2.Request(setURL)
response = opener.open(request)
url = "http://www.wunderground.com/global/stations/54511.html?MR=1"
request = urllib2.Request(url)
page = opener.open(request)
WeatherData = page.read()
print WeatherData
So it print all the data but I want to print only the :
Datetime (timestamp of data captured) - Current Condition - Temperature
like I said need advice.like :
what should I use to complete this task.
How can set the data collect for (days), I don't know..
I don't need the full answer and copy paste, I'm not fool...
I want to UNDERSTAND.
Weather Underground have posted a Python sample to access their API. I think you'd be best off using their code. If you play around with the parsed_json
variable in the example, you should be able to get what you want.
As for running the program after fixed intervals, check out this thread.