Cookies are data that the site stores on the user's local terminal in order to identify the user and perform session tracking (usually encrypted)Before that, you must first introduce the concept of a opener.
1.Opener
When you get a URL you use a opener (a urllib2. instance of Openerdirector).
Previously we were all using the default
Bootloaderand Kernel decompressionBootloaderload the kernel into memory, set some registers, and then turn control over to the kernel, which shuts down the MMU function during the process . Typically, the kernel is stored in a compressed manner, such as Zimage, where two methods of decompression are available: Use the kernel self-extracting program.Arch/arm/boot/compressed/head. S or arch/arm/boot/compressed/head-xxxxx. SArch/arm/boot/compressed/misc.cAdd the decompression function to the b
process, the scheduling system of the kernel contains a list of priorities of all threads in the current process, and all threads are sorted by priority. When an interruption occurs, the scheduling system reschedule the arrangement of all threads.A process is an instance of a running application. It consists of two parts: one is the kernel object used by the operating system to manage the process. The other is the address space owned by the process. This address space contains the application's
process, the scheduling system of the kernel contains a list of priorities of all threads in the current process, and all threads are sorted by priority. When an interruption occurs, the scheduling system reschedule the arrangement of all threads.A process is an instance of a running application. It consists of two parts: one is the kernel object used by the operating system to manage the process. The other is the address space owned by the process. This address space contains the application's
Memory Address Allocation: configuration of config. bib
Author: Lai yuping (auly) aulyp@163.com
In the embedded wince system, memory allocation is set through the config. bib file, such as allocating the video address, RAM address, and Rom address. The following describes in detail some keywords used in this file and different Address Allocation when using NK mirror or xip.
(1) ramimage is an image placed in ram, and the address space is not control
, provides the most basic method, Defult_open (), protocol_request (), etc.Various inherited handler subclasses of this Basehandler parent class:
Httpdefaulterrorhandler: for handling HTTP response errors, errors will throw exceptions of type Httperror
Httpredirecthandler: Handling redirects
Httpcookieprocessor: Handling Cookies
Proxyhandler: Set proxy, default proxy is empty
Httppasswordmgr: Manage password, maintain the user name and password of the table
Httpbasic
There are a number of useful tools classes in the Python standard library, but when used specifically, the standard library documentation does not describe the details of the usage, such as URLLIB2 this HTTP client library. Here is a summary of some of the URLLIB2 library usage details.
1 setting of Proxy
URLLIB2 uses environment variable HTTP_PROXY to set HTTP proxy by default. If you want to explicitly control the Proxy in your program without being affected by the environment variables, you
})Else:Proxy_handler = urllib2.proxyhandler (google_proxy)Opener = urllib2.build _ opener (proxy_handler)# Set the opener as the default OpenerUrllib2.install _ opener (opener)
In addition, "resp = urllib2.urlopen (request, Params)" is used to open the connection. In this
Python imitates the POST method to submit HTTP data and use the Cookie value.
This article describes how to simulate post http data and submit data with cookies in Python. The specific implementation method is as follows:
Method 1
If you do not use cookies, it is very easy to send http post:Copy codeThe Code is as follows: import urllib2, urllibData = {'name': 'www ', 'Password': '000000 '}F = urllib2.urlopen (Url = 'HTTP: // www.bkjia.com /',Data = urllib. urlencode (data))Print f. read ()When
= { "user-agent":"mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) gecko/20100101 firefox/50.0", "Referer":"http://tieba.baidu.com/f?kw=%E4%BF%9D%E5%AE%9Aie=utf-8pn=50"}request= Urllib2. Request (url=url,data=data,headers=header) Response=Urllib2.urlopen (Request)PrintResponse.read ()View CodeUrlopen is urllib2. An instance of Openerdirector, a opener, a special default opener. Therefore, this
? Webid = 1 tid = 901 cateid = 101 "). read ()Doc = json. loads (doc)Print docPrint doc. keys ()Print doc ["msg"]Print doc ['data']Print doc ['ret ']
The time required for the first access is [Finished in 3.0 s].
The second access time is [Finished in 0.2 s].
It can be seen that the urllib module of python is cached.
A typical example of urllib/2 usage
The code is as follows:
Import urllib2Import cookielibImport urllib
Class Hi_login:Def _ init _ (self ):Cookie = cookielib. CookieJar ()Self.
checkproxy () process. It creates 10 threads, uses the map function to start these 10 threads at the same time, and finally waits for the thread to exit. Then, the data in the proxycheckedlist in the queue is processed again. These 10 threads share the same job. They read 10 HTTP proxy data (IP address, port, etc.) from a queue's proxycheckedlist ), then, the validity of the 10 pieces of data is judged iteratively. The validity judgment ideas are as follows:
Use urllib2.httpcookieprocessor () t
Recently, the project used the. NET Server control again!
It is found that the showmodaldialog method in Chrome does not display a modal dialog box. Just like opening a page, the parent window can still obtain the focus at will and open multiple forms, in addition, the returned returnvalue cannot be returned, which is always undefined. So many problems are a headache. Next we will test the latest mainstream browsers.
Browser
Supported?
Status
Ie9
○
. Opener = NULL ;//If this statement is not added, the system will prompt to close the inquiry window.;
Window. Parent. Close ();
II,Window. OpenArticle
1.Parent window operation on Child Window
Open:
VaR win = NULL;
Win = Window. Open ("open.html", "win", "width = 200, Height = 200 ");
Maximize:
//Window Maximization
Function sonmaximize ()
{
If (WIN Win. Open ! Win. Closed)
{
Win. moveTo (-4,-4 );
Win. resizeTo (screen.
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.