Urllib
1 | import urllib2 |
analysis
urlopen(url)
urlopen(url, data, timeout)
urlopen(Request)
- Is this a multi status in python
- timeout in default is socket._GLOBAL_DEFAULT_TIMEOUT
- data in default is null
request = urllib2.Request("http://www.linchenguang.com")
Get
1 | import urllib |
- data compatible with json, array style is similar with js
- data need urlencode prevent unreserved characters ambiguity
- data parameters connect with url with
?
Post
1 | import urllib |
- data be referenced in Request method as a parameter
- post has two phase transport progress