There is a weather forecast demand in the project. I found a suggestion on the Internet for most people to use WebService to obtain data. So I tried to do it. I did not know it, but I learned a lot from it.
First, let's get the weather service provided by the National Meteorological Administration through WebService.
The android SDK does not provide a library to call WebService. Therefore, you must use a th
There is nothing to do to get the weather API, roughly checked, the domestic relatively good or Chinese weather Network (China Meteorological station), the portal has Sina and Tencent (search), other some small sites worry about instability, so no use.
The simplest script. Send a request to get JSON and parse it and
above contains a picture name that can be accessed through the address
Http://m.weather.com.cn/img/c0.gif
Http://m.weather.com.cn/img/b0.gif
Http://www.weather.com.cn/m/i/weatherpic/29x20/d0.gif
http://www.weather.com.cn/m2/i/icon_weather/29x20/n00.gif
This is a picture of weather phenomena 0 (clear), pictures of other weather phenomena and so on. c The picture is 20*20 pixels, B
Wind Weather website: https://www.heweather.com/After registration there will be a personal authentication key in the consoleAPI Help Documentation: HTTPS://WWW.HEWEATHER.COM/DOCUMENTS/API/V5#!/usr/bin/python#-*-coding:utf-8-*-#调用和风天气API查询当前天气信息 #2017/07/12import jsonimport urllib2import oscity= ' Beijing ' # keykey= ' your key ' city_name={' Beijing ': ' Beijing
Requirements: The title is actually very clear, the specific point is to use HTTP request Google Weather API, get a standard XML file, the XML file contains the weather data we need, then we are parsing this XML document to get the weather data.
Visit
Weather forecast query Interface API, here I am using the National Weather forecast interfaceUse more also: Sina weather interface, Baidu weather interface, Google weather interface, Ya
weather forecast API, the result has really found a:4. and wind Weather API (OK)Various Interface API documentation ... Well, say it in detail. Suddenly burst into tearsSign up and get up.Finally there is a message back, good detail, decided to use this.Second, the Analytic
/) to apply for trial free API, but so-called free, Also only tentative free, later will not charge is unknown.Integrated three API, the first two data is too thin, but also is real-time weather, no future days of weather data, can not meet the demand, the previous general third also can not be used. By the way, the
The China Meteorological Bureau provides three API interfaces for weather queries:"1" http://www.weather.com.cn/data/sk/101190101. html"2" http://www.weather.com.cn/data/cityinfo/101190101. html"3" http://m.weather.com.cn/data/101190101. htmlReturns data in JSON format, the first and second interfaces return real-time weather
Step1: Select the interface "National Weather forecast Interface" aggregated data url:http://www.juhe.cn/docs/api/id/39/aid/87 The example in this article
Step2: Each interface needs to pass in a parameter key, which is equivalent to the user's token, so the first step is to apply for a key.
step3: The students who have studied Java know that when we do not understand a class or method of their intentions
API Address:PM2.5 APIhttp://api.lib360.net/open/pm2.5.json?city= Luoyang7 days 24 Hours weather APIhttp://api.lib360.net/open/weather.json?city= SuzhouGET RequestParametersProv optional provinces such as: Jiangsu, HebeiCity name: Suzhou, ShanghaiReturn Data format JSONThe data field returns 7 days of weather conditions
We will see that many websites can display the local weather in real time. let me tell you how to do this in real time, you can use the googleaip interface to obtain the weather conditions of different cities and display them on your website. Se. phpnbsp...
We will see that many websites can display the local weather in real time. let me tell you how to do this i
This article mainly introduces how to obtain weather information from Baidu API by using Python. The example analyzes the skills of using Python to operate Baidu API, which has some reference value, for more information about how to obtain weather conditions from Baidu API,
Use bo api to create weather check software, boapi
Let's take a look at the effect.
Interface address: http://service.boapi.net/Weather/Weather.ashx? Appkey = The appkey city = city name you applied
Interface Description view http://www.boapi.net/weather.htm
Key code of request service
JToken WheatherJson (string city) {WebClient wc = new WebClient (); strin
Free to do nothing, get a few API interface, share to the same need (busy) to (not) peopleAPI interfaces are in HTTP form, data is in JSON format, Ajax calls are supported (all domain access is open)Joke APIDescription: Return the joke list after the call, you can set the maximum joke ID and the minimum joke ID that have been obtained in the parameter, return the result will return the new joke (currently a
Ajax obtains data by city name (National Weather Forecast API) and ajaxapi
Preview a chart (relatively simple and rough)
Aggregate Data National Weather Forecast interface: https://www.juhe.cn/docs/api/id/39
Interface address: http://v.juhe.cn/weather/indexSupported formats
Let's take a look at the effect.Interface Address: http://service.boapi.net/Weather/Weather.ashx?appkey= The name of the appkeycity= city you applied forInterface Description Details View http://www.boapi.net/weather.htmRequest Service Critical CodeJtoken Wheatherjson(StringCity){ WebClientWc= New WebClient(); StringJson= ""; Try {Wc.Encoding = System.Text.Encoding.utf8; json = Wcdownloadstring ( + City re
This example describes Python's approach to getting the weather from the Baidu API. Share to everyone for your reference. The implementation methods are as follows:
Copy Code code as follows:
__author__ = ' Saint '
Import OS
Import Urllib.request
Import Urllib.parse
Import JSON
Class Weather (object):
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.