[PYTHON] Play with the power usage API provided by Yahoo

It's still not beautiful, though. area is hokkaido (within the jurisdiction of Hokkaido Electric Power Company) tohoku (under the jurisdiction of Tohoku Electric Power) tokyo (within the jurisdiction of TEPCO) chubu (within the jurisdiction of Chubu Electric Power) kansai (Kansai Electric Power jurisdiction) kyushu (Kyushu Electric Power jurisdiction You can change the acquisition area with.

denryoku.py



#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import requests
import json,urllib2
import sys, codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout)

url = "http://setsuden.yahooapis.jp/v1/Setsuden/latestPowerUsage?"
appid = "appid=**************************************************"
output = "&output=json"
area = "&area=tokyo"
req_seq = url + appid + output + area

r = requests.get(req_seq)
res = r.json()

for i in res:
	print json.dumps(res, sort_keys = True, indent = 4)

Recommended Posts

Play with the power usage API provided by Yahoo
Play with puns using the COTOHA API
Play music by hitting the unofficial API of Google Play Music
Ask the bot to tell you the weather (precipitation information) using the weather information API (YOLP) provided by Yahoo ~ slack bot development with python ④ ~
Play RocketChat with API / Python
Call the API with python3.
Specifying the date with the Twitter API
Hit the Etherpad-lite API with Python
Play by hitting the Riot Games API in Python First half
Let's play with the corporate analysis data set "CoARiJ" created by TIS ①
Let's play with the corporate analysis data set "CoARiJ" created by TIS ②
Access the Docker Remote API with Requests
Play around with the pythonista3 ui module
Install by specifying the version with pip
Get holidays with the Google Calendar API
Let's create it by applying Protocol Buffer to the API with Serverless Framework.
Image analysis was easy using the data and API provided by Microsoft COCO.
Until you use the Kaggle API with Colab
I wanted to play with the Bezier curve
Broadcast operation by raising the dimension with np.newaxis