Come here to find like-minded small partners! ↑↑↑
Python applications are now in full swing with a wide range of applications. Fast access to the top of the programming language rankings due to its rapid development and high efficiency. This series of articles is dedicated to a comprehensive and systematic introduction of Python language development knowledge and related knowledge summaries. I hope you can get started quickly and learn the language of Python.
This course is based on the mastery of Python. If you don't learn the basics, you should review the article Learning Basics directory: Python development tutorial Series-Link summary, continuous update. To learn.
In recent days, the cold, limb weakness and recent busy results, the update is slow. Please forgive me.
Overview
Many times we need to submit data to the Web page, for example: Login interface
Post posting:
All of these require us to submit the data. As we all know, many times we also need to use Python to send requests for data.
Requirements:
Development environment: Python 2.7, Pycharm 5 Community
Required Knowledge: Requests module, Python basic syntax.
We use the API interface of Sina weather to make the weather forecast query.
Sina Weather Forecast API
Http://php.weather.sina.com.cn/xml.php?city=%B1%B1%BE%A9&password=DJOYnieT8234jlsK&day=0
One of the cities after the city transcoding.
Password fixed
Day is 0 for today's weather, 1 for the next day, 2 for the third day, and so on for a maximum of 4
The Return Code Format section of the XML tag describes:
The label 1 means daytime, 2 means night |
|
<status>< figure><direction><power><temperature><ssd><ssd_l><ssd_s ><tgd><zwx><zwx_l><zwx_s><ktk><ktk_l><ktk_s><pollution>< Pollution_l><pollution_s><xcz><xcz_l><xcz_s><chy><chy_l><chy_ shuoming><gm><gm_l><gm_s><yd><yd_l><yd_s><zho><zho_l>< zho_shuoming><diy><diy_l><diy_shuoming><fas><fas_l><fas_shuoming>< Savedate_weather><savedate_life><savedate_zhishu> |
Weather conditions Chinese weather conditions Pinyin wind direction wind temperature somatosensory index numerical body sensitivity index Body Sensitivity index description Body Sense Temperature UV Index Numerical UV Index UV Index Description Air conditioning index numerical air conditioning index air Conditioning index description Pollution index numerical pollutant diffusion condition Pollution Index Description Car Wash index value Wash Car index washing index description Clothing index value wear index wear Clothing Description Cold Index numerical Cold index Cold Index Description Movement Index numerical Movement Index Movement Index Description weather Forecast Date Life Date Index Date |
This interface get request submits data code:
Post Submission data:
This article may have a lot of impromptu questions, please also ask questions in the below discussion area. For discussion.
After a few days, the article will be updated regularly. Thanks for the support, do the full stack siege lion.
Next: Python Tutorial: Operating the database, MySQL installation detailed
Python Development Tutorials (8)-submit data to a Web page