SB Components
Published

Use Raspberry Pi as a Weather Forecaster

This blog explains to you how to use your Raspberry Pi as a weather forecaster using weatherbit API. Readout full details here.

IntermediateFull instructions provided2,061
Use Raspberry Pi as a Weather Forecaster

Things used in this project

Hardware components

Raspberry Pi
×1
Power Supply (5v, 2.5 Amps)
×1
Internet Connection
×1
Weatherbit account
×1

Story

Read more

Code

Code snippet #1

Plain text
import requests
from pprint import pprint

Key = 'Your API key'

params = {
  'city': 'london',
  'country' : 'UK',
  'units' : 'M'}

BASE_URL = "https://api.weatherbit.io/v2.0/current?"

for key value in params.items():
  BASE_URL += key + '=' + value + '&'

BASE_URL += 'key={}'.format(Key)

Data = requests.get(BASE_URL)
Weather = Data.json()
pprint(Weather)

Credits

SB Components

SB Components

36 projects • 14 followers
The Maker Community Store – We help you to make things intelligent using Raspberry Pi, Micro:Bit, Arduino, robotics, etc.

Comments