@@ -3,41 +3,41 @@ Httplib2
3
3
--------------------------------------------------------------------
4
4
Introduction
5
5
6
- A comprehensive HTTP client library, httplib2.py supports many
6
+ A comprehensive HTTP client library, httplib2.py supports many
7
7
features left out of other HTTP libraries.
8
8
9
9
HTTP and HTTPS
10
- HTTPS support is only available if the socket module was
11
- compiled with SSL support.
10
+ HTTPS support is only available if the socket module was
11
+ compiled with SSL support.
12
12
Keep-Alive
13
- Supports HTTP 1.1 Keep-Alive, keeping the socket open and
14
- performing multiple requests over the same connection if
15
- possible.
13
+ Supports HTTP 1.1 Keep-Alive, keeping the socket open and
14
+ performing multiple requests over the same connection if
15
+ possible.
16
16
Authentication
17
- The following three types of HTTP Authentication are
17
+ The following three types of HTTP Authentication are
18
18
supported. These can be used over both HTTP and HTTPS.
19
19
20
20
* Digest
21
21
* Basic
22
22
* WSSE
23
23
24
24
Caching
25
- The module can optionally operate with a private cache that
26
- understands the Cache-Control: header and uses both the ETag
27
- and Last-Modified cache validators.
25
+ The module can optionally operate with a private cache that
26
+ understands the Cache-Control: header and uses both the ETag
27
+ and Last-Modified cache validators.
28
28
All Methods
29
- The module can handle any HTTP request method, not just GET
29
+ The module can handle any HTTP request method, not just GET
30
30
and POST.
31
31
Redirects
32
32
Automatically follows 3XX redirects on GETs.
33
33
Compression
34
34
Handles both 'deflate' and 'gzip' types of compression.
35
35
Lost update support
36
- Automatically adds back ETags into PUT requests to resources
37
- we have already cached. This implements Section 3.2 of
36
+ Automatically adds back ETags into PUT requests to resources
37
+ we have already cached. This implements Section 3.2 of
38
38
Detecting the Lost Update Problem Using Unreserved Checkout.
39
39
Unit Tested
40
- A large and growing set of unit tests.
40
+ A large and growing set of unit tests.
41
41
42
42
43
43
For more information on this module, see:
@@ -63,16 +63,16 @@ A simple retrieval:
63
63
h = httplib2.Http(".cache")
64
64
(resp_headers, content) = h.request("http://example.org/", "GET")
65
65
66
- The 'content' is the content retrieved from the URL. The content
66
+ The 'content' is the content retrieved from the URL. The content
67
67
is already decompressed or unzipped if necessary.
68
68
69
69
To PUT some content to a server that uses SSL and Basic authentication:
70
70
71
71
import httplib2
72
72
h = httplib2.Http(".cache")
73
73
h.add_credentials('name', 'password')
74
- (resp, content) = h.request("https://example.org/chapter/2",
75
- "PUT", body="This is text",
74
+ (resp, content) = h.request("https://example.org/chapter/2",
75
+ "PUT", body="This is text",
76
76
headers={'content-type':'text/plain'} )
77
77
78
78
Use the Cache-Control: header to control how the caching operates.
@@ -81,42 +81,42 @@ Use the Cache-Control: header to control how the caching operates.
81
81
h = httplib2.Http(".cache")
82
82
(resp, content) = h.request("http://bitworking.org/", "GET")
83
83
...
84
- (resp, content) = h.request("http://bitworking.org/", "GET",
84
+ (resp, content) = h.request("http://bitworking.org/", "GET",
85
85
headers={'cache-control':'no-cache'})
86
86
87
- The first request will be cached and since this is a request
88
- to bitworking.org it will be set to be cached for two hours,
89
- because that is how I have my server configured. Any subsequent
90
- GET to that URI will return the value from the on-disk cache
91
- and no request will be made to the server. You can use the
92
- Cache-Control: header to change the caches behavior and in
93
- this example the second request adds the Cache-Control:
94
- header with a value of 'no-cache' which tells the library
95
- that the cached copy must not be used when handling this request.
87
+ The first request will be cached and since this is a request
88
+ to bitworking.org it will be set to be cached for two hours,
89
+ because that is how I have my server configured. Any subsequent
90
+ GET to that URI will return the value from the on-disk cache
91
+ and no request will be made to the server. You can use the
92
+ Cache-Control: header to change the caches behavior and in
93
+ this example the second request adds the Cache-Control:
94
+ header with a value of 'no-cache' which tells the library
95
+ that the cached copy must not be used when handling this request.
96
96
97
97
98
98
--------------------------------------------------------------------
99
99
Httplib2 Software License
100
100
101
101
Copyright (c) 2006 by Joe Gregorio
102
102
103
- Permission is hereby granted, free of charge, to any person
104
- obtaining a copy of this software and associated documentation
105
- files (the "Software"), to deal in the Software without restriction,
106
- including without limitation the rights to use, copy, modify, merge,
107
- publish, distribute, sublicense, and/or sell copies of the Software,
108
- and to permit persons to whom the Software is furnished to do so,
103
+ Permission is hereby granted, free of charge, to any person
104
+ obtaining a copy of this software and associated documentation
105
+ files (the "Software"), to deal in the Software without restriction,
106
+ including without limitation the rights to use, copy, modify, merge,
107
+ publish, distribute, sublicense, and/or sell copies of the Software,
108
+ and to permit persons to whom the Software is furnished to do so,
109
109
subject to the following conditions:
110
110
111
- The above copyright notice and this permission notice shall be
111
+ The above copyright notice and this permission notice shall be
112
112
included in all copies or substantial portions of the Software.
113
113
114
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
115
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
116
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
117
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
118
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
119
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
120
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
114
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
115
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
116
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
117
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
118
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
119
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
120
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
121
121
SOFTWARE.
122
122
0 commit comments