PYTHON make use of desktop web crawler (a)

1. The need to install the modules tools

Write desktop software, part of CS architecture. The so-called CS architecture:

C / S structure, namely Client / Server (Client / Server) structure, is well-known software system architecture, through the rational allocation of tasks to the Client side and Server-side, reducing communication overhead system, you can take advantage of both ends advantage of the hardware environment.

To take advantage of late and we will PYTHON crawling web content production is clearly belongs to BS Architecture:

B / S structure, i.e. Browser / Server (Browser / Server) structure, along with the rise of Internet technology, a variation of C / S structure or improved structure. In this structure, the user interface is fully achieved by the WWW browser, the front end part of the transaction logic implementations, but the main business logic on the server side, forming a so-called 3-tier structure.

Write desktop software with PYTHON mainly about Tkinter, PyQt, wxPython and so on. Three have advantages and disadvantages, this time we will use PyQt to write. There are packaged module py2exe and pyinstalle, the same advantages and disadvantages. The use of py2exe package.

The system uses, PYTHON version of libraries and other necessary documents:

windows system

Python 2.7

PyQt4

lxml

py2exe

Prior also said that this set of tutorials apply to white. There may be doubts, so much nouns, for we do not know is completely white ah. Do not worry, I do not know too much. / (¨Ò o ¨Ò) / ~~ Just do it!

Why PyQt using it, because there are PyQt Designer:

13406307-fbf7b8483dcb112b.png

We do not ask for the aesthetic appearance of the interface, it is sufficient to draw it yourself.

2. Write (draw) software interface

Open Desinger:

13406307-c71391fab64e56bf.png

Select Widget began to drag to draw their own interface it. The left control in the process of drawing software will be used mainly Push Button, Label, Line Edit, Text Edit, Radio Button, Check Box and so on. Remember to give each space a fitting objectName, because when implementing functions will be used later. Then I drew the following interface.

13406307-5203ae877b3dd7bb.png

With this interface, it is estimated we can guess the function I want to achieve. Yes, yes, this software is mainly used to achieve a live update function. You need to complete the following:

Through the account, password target site.

Source code page of the target after landing.

Parsing the source code, update to the interface.

The crawl to live a text message sent to the development of the QQ friends or QQ group.

Crawl the fixed time intervals, the timing of the update.

After the draw a good interface, save it, named qq_define.ui. Because so far, this was a ui interface, we use the software must be written in python .py to the line ah. So, I want to, ui compiled as .py, how to compile it?

.Ui switch to save the address of the file, open cmd command window, enter: pyuic4 qq_define.ui> qq_define.py, can be compiled to .py .ui matter, O (∩_∩) O ~~

Open qq_define.py take a look:

13406307-0f71721e5c97d170.png

Guess you like

Origin blog.csdn.net/weixin_34050427/article/details/91010993