Sample of HTTP GET and JSON parsing with python of pepper

I made it based on Create HTTP Get Box.

The API is this weather API. http://weather.livedoor.com/forecast/webservice/json/v1?city=200010

class MyClass(GeneratedClass):
    def __init__(self):
        GeneratedClass.__init__(self)

    def onLoad(self):
        #put initialization code here
        pass

    def onUnload(self):
        #put clean-up code here
        pass

    def onInput_onStart(self, url):
        import urllib2, json
        api = "http://weather.livedoor.com/forecast/webservice/json/v1?city=200010"
        r = urllib2.urlopen(api)
        root = json.loads(r.read())
        self.onStopped(root['title'].encode('utf8'))



Recommended Posts

Sample of HTTP GET and JSON parsing with python of pepper
Compare HTTP GET / POST with cURL (command) and Python (programming)
JSON encoding and decoding with python
Get rid of dirty data with Python and regular expressions
Coexistence of Python2 and 3 with CircleCI (1.0)
Reading and writing JSON files with Python
Get images of OpenStreetMap and Geographical Survey Institute maps with Python + py-staticmaps
Get images of OpenStreetMap and Geographical Survey Institute maps with Python + staticmap
Get and estimate the shape of the head using Dlib and OpenCV with python
Read JSON with Python and output as CSV
Get git branch name and tag name with python
[Python] Get rid of dating with regular expressions
Compare xml parsing speeds with Python and Go
Implementation of TRIE tree with Python and LOUDS
Get CPU information of Raspberry Pi with Python
Get Gmail subject and body with Python and Gmail API
Continuation of multi-platform development with Electron and Python
If you get lost with HTTP redirects 301 and 302
Example of reading and writing CSV with Python
Competitive Pro with Python and VSCode-Simplification of standard input and automation of sample case judgment-
Get the stock price of a Japanese company with Python and make a graph
[Python] Use JSON with Python
HTTP communication with Python
Get date with python
Get media timeline images and videos with Python + Tweepy
Easy partial download of mp4 with python and youtube-dl!
Visualize the range of interpolation and extrapolation with python
Parse and visualize JSON (Web application ⑤ with Python + Flask)
Get comments on youtube Live with [python] and [pytchat]!
Read json file with Python, format it, and output json
Get the operation status of JR West with Python
[Python] Get user information and article information with Qiita API
Get an abstract understanding of Python modules and packages
Get the URL of the HTTP redirect destination in Python
[Python] I tried to get Json of squid ring 2
Sample of getting module name and class name in Python
Comparison of CoffeeScript with JavaScript, Python and Ruby grammar
Version control of Node, Ruby and Python with anyenv
Get a large amount of Starbucks Twitter data with python and try data analysis Part 1
Sample data created with python
Programming with Python and Tkinter
Encryption and decryption with Python
Python and hardware-Using RS232C with Python-
Get Twitter timeline with python
POST json with Python3 script
Get Youtube data with python
Get a list of purchased DMM eBooks with Python + Selenium
I tried to get the number of days of the month holidays (Saturdays, Sundays, and holidays) with python
Detect objects of a specific color and size with Python
Debug with PEPPER python interpreter
Get thread ID with python
Easy HTTP server with Python
Get started with Python! ~ ② Grammar ~
python with pyenv and venv
[python] Get quotient and remainder
Format json with Vim (with python)
Get stock price with Python
Get home directory with python
[Python x Zapier] Get alert information and notify with Slack
Get keyboard events with python
Source installation and installation of Python