[PYTHON] Pepper Web API cooperation explanation For those who have no experience in Pepper application development / programming

I will post on Qiita for the first time.

This article is intended for: --Inexperienced in programming ――I want to develop a Pepper app --I want to use an external Web API I will explain for those who apply to the above. I think there will be some points that are difficult to understand, but I would appreciate it if you could ask in the comments. Also, if there are any deficiencies, we would appreciate it if you could point them out in the comments.

About this article

This time, I will introduce how to use WebAPI in Pepper application. So, if you read this article, I think that even those who have recently started to touch Pepper will be able to acquire knowledge so that they can link with WebAPI. If you need a detailed explanation of terms, I think that this article will be easier to read if you visit the following reference site.

reference

Use Requests for Pepper HTTP communication http://qiita.com/bugcloud/items/6631b2a534446393e214 [Pepper] Cooperation with weather API http://qiita.com/yamarobo/items/e57cb2e3f5ac21464bfa

I referred to the above site. In addition, I will use the article by yamarobo in this article, and I will explain it for the target audience.

Development environment

Mac OS X El capitan 10.11.1 Choregraphe 2.4.2 Python 2.7.10

API used

Open Weather Map API

What is Web API?

It refers to the rules for handling other services on the Web. Basically, we provide data and services. It is a mechanism that sends a request to the server and sends back the result (Response) obtained by processing the request. Basically, the format of the request and the result is fixed, each request is REST, and the result is handled in JSON or XML.

WebAPI can be used in many computer programs, including platforms such as various operating systems such as Android, iOS, and Windows, and robot-embedded programs.

There are quite a few Web APIs currently available. For example, various Web APIs are provided, such as weather forecasts, disaster information, and article searches. All of the Web APIs listed above can be used. (Although some require you to get a key to access, called an API key. By using these, not only the Pepper app but also the apps you create will be richer.

What is WebAPI linkage?

Combining the above-mentioned API and platform-side program is called API linkage. Combining APIs with each other is also called a mashup. You can easily make up for parts that are difficult to realize or express with that platform alone by using APIs.

How to work with Pepper

Originally, in order to use Pepper as a platform, you need to understand the following. --API access method --Choregraphe box operation --About the Python box in Choregraphe --How to generate HTTP request by Python

Web API Linked application flow example

There are no restrictions such as API access must always be done when the app is launched. Therefore, you can access the API at any time within the app and bring in the necessary data. For example, if you take the application created on yamarobo's site as an example, you can see that the flow is as follows.

  1. Change Pepper's language setting to Japanese when launching the app
  2. Perform HTTP communication (GET communication, POST communication)
  3. Parse (analyze) the data acquired by communication
  4. Let Pepper speak the parse result

Also, Choreograph can be seen as the flow of the application by connecting the boxes. Unlike programs, I think that you can visually and intuitively check the transition of the application. For example, if you borrow a program from yamarobo and create an app that is more user-friendly and has a Pepper feel, the flow will be as follows. The image will be the image of the app you actually created.

  1. Set the language setting to Japanese in the set Language box when the app starts.
  2. Use the Say box to ask, "Do you want to know the weather today and tomorrow?"
  3. Using the Speech Reco. Box and Switch Case box, listen to the user's "yes" or "no" and transition according to the corresponding conditions.
  4. If yes, speak the weather forecast in the same way as yamarobo's app. If "No", say "Yes, I'm waiting for you to use it again!"
  5. Exit the app  2015-12-17 20.19.13.png

At the end

This time I wrote about API cooperation using Pepper. We hope that you will read this article and increase the number of Pepper application developers and developers. Also, if anyone is interested, I would like you to work on it. In addition to this article, various people are explaining the contents explained this time. If you are not satisfied with the content explained this time, or if you would like to see explanations using various APIs, please see Qiita and various sites. I think it was a long sentence and it was difficult to understand, but thank you for staying with us until the end. Finally, I pray from the bottom of my heart for your success and development.

December 17, 2015

Recommended Posts

Pepper Web API cooperation explanation For those who have no experience in Pepper application development / programming
An introduction to Web API development for those who have completed the Progate Go course
I tried to teach Python to those who have no programming experience
Web application development memo in python
Web application development in Go language_Hands-on day 1
For those who have done pip uninstall setuptools
[For those who have mastered other programming languages] 10 points to catch up on Python points
For those who are new to programming but have decided to analyze data with Python