Python Development Tutorials (8)-submit data to a Web page

Source: Internet
Author: User

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

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.