Show forecast using Yahoo! Weather
Note: This snippet uses piksemel module to parse XML files. If you don't have it, read this article to install it.
First of all, you need the WOEID (Where on Earth Identification) of the city. In order to learn it, go to http://weather.yahoo.com and search for the city. You'll find the WOEID at the end of the url of the page.
# for Istanbul, TR woeid = 2344116
Use this id in Yahoo! Weather API url, for w parameter.
weatherUri = "http://weather.yahooapis.com/forecastrss?w=%d" % woeid
If you want the results to be in metric units, add u=c parameter into your query.
weatherUri = "http://weather.yahooapis.com/forecastrss?w=%d&u=c" % woeid
Using urllib, fetch the XML file:
import urllib xml = urllib.urlopen(weatherUri).read()
We can parse this XML easily using piksemel:
import piksemel
temp = piksemel.parseString(xml).getTag('channel').getTag('item').getTag('yweather:condition').getAttribute('temp')
You can also view XML file and look for other resources such as: humidity, visibility, wind, etc.
yatp: yet another transfer protocol
In the beginning of March, I started to a new project with my room-mate Diego.
The main problem is sharing. We shouldn't be sending e-mails to our friends to share a link, a document file, a presentation or some pictures. We shouldn't try to memorize a TinyURL to tell a friend. Instant messengers? Eww! We hate those, who doesn't?
Instant messengers are often useful. However there are many alternatives. Most of them requires you to be online to receive messages, and your online status will be public to your contacts. Most of them uses more then 30 MB of your computer memory. You cannot use them in a network which has no internet connection. Lots of disadvantages.
There's also no easy way to share files. Websites providing file sharing services make you to much, enter a CAPTCHA image, then wait again. You cannot share a file even if you're in the same network. OS differences, lack of configuration, bugs, security holes...
We are planning to create a new service based on HTTP to simplify sharing things between friends, especially whose computers are in the same network. We called it yatp, yet another transfer protocol, even it's not a protocol. We did some brainstorming and created a website. More details will be announced later. And do not forget to visit: yatp.net
Sharing will be fun.