Monthly Archives: January 2017

Hakology Update …

I’m still hacking! Sorry i’ve been neglecting to keep you up to date i’ve just been very busy recently, as you may know or not know for the last few weeks i’ve been starting up a new company. Finally things are looking good money is starting to flow and word of mouth is getting about. Most of my time is currently invested in making and designing new products for that company. It’s been a hell of a lot of hard work but things are starting to come together.

The other bit of news I wanted to tell you guys is i’ve been lucky enough to get involved with irongeek and his new weekly podcast. I really dont have time to write this up at the moment but will fill you in on another blog post soon.

Have fun hacking!
BBS
Tea.

Hakology Blog (D90) – Things and stuff …

Well first of all happy new year to all! … Today marks the start of a new journey for me, I quit my last job in September last year, I needed a change something new, over the last three months I’ve been gathering all the tools to upcycle old objects, make old new again etc. I’ll hopefully get chance to start incorporating bigger projects in the vblog and you lot will see my mini workshop! Still have a lot of work to do, I’ll write another blog when I have some free time. Once again happy new year and have fun hacking!

Hakology – How to grab openweathermap data using python.

I’ve been playing with the openweathermap api thought i’d share a little code, the following pulls the json and constructs a string containing the location, temp, tax temp, min temp and humidity. You will need to sign up for an API key and free user account 1st. The free account at the time of writing this allows 50k calls a day so if you’re writing for a small personal project 50k calls should be fine.

Copy the code below to a file
eg. displayweather.py

chmod the file if needed …
sudo chmod +x displayweather.py

run the file using …
python displayweather.py

import requests
r = requests.get('http://api.openweathermap.org/data/2.5/forecast/city?id=YOURCITYIDGOESHERE&APPID=YOURAPIKEYGOESHERE')
data = r.json()
mystring = ""
mystring = mystring + data['city']['name'] + " "
mystring = mystring + "Temp:" + str(int(data['list'][0]['main']['temp'] - 273.15)) + "C "
mystring = mystring + "Max:" + str(int(data['list'][0]['main']['temp_max'] - 273.15)) + "C "
mystring = mystring + "Min:" + str(int(data['list'][0]['main']['temp_min'] - 273.15)) + "C "
mystring = mystring + "Hum:" + str(data['list'][0]['main']['humidity']) + "% "
print mystring

Click here to download the file.