|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| doc/ | | 03-May-2024 | - | 9,354 | 6,868 |
| python2/ | | 03-May-2024 | - | 7,868 | 6,602 |
| python3/ | | 03-May-2024 | - | 7,036 | 5,967 |
| ref/ | | 03-May-2024 | - | 1,797 | 1,605 |
| script/ | | 03-May-2024 | - | 445 | 367 |
| test/ | | 03-May-2024 | - | 434 | 261 |
| tests/ | | 03-May-2024 | - | 3,781 | 3,072 |
| .gitignore | D | 03-May-2024 | 284 | 32 | 31 |
| .travis.yml | D | 03-May-2024 | 3.8 KiB | 94 | 90 |
| Android.bp | D | 03-May-2024 | 2.7 KiB | 87 | 80 |
| CHANGELOG | D | 03-May-2024 | 13.9 KiB | 424 | 282 |
| LICENSE | D | 03-May-2024 | 1.1 KiB | 24 | 19 |
| MANIFEST.in | D | 03-May-2024 | 258 | 12 | 11 |
| METADATA | D | 03-May-2024 | 533 | 23 | 22 |
| MODULE_LICENSE_MIT | D | 03-May-2024 | 0 | | |
| Makefile | D | 03-May-2024 | 1.8 KiB | 45 | 38 |
| OWNERS | D | 03-May-2024 | 212 | 5 | 4 |
| README.md | D | 03-May-2024 | 2.9 KiB | 114 | 77 |
| SECURITY.md | D | 03-May-2024 | 916 | 20 | 11 |
| index.html | D | 03-May-2024 | 7.1 KiB | 208 | 154 |
| libhttplib2.tex | D | 03-May-2024 | 17.9 KiB | 455 | 367 |
| pyproject.toml | D | 03-May-2024 | 201 | 10 | 7 |
| ref.tex | D | 03-May-2024 | 1.9 KiB | 92 | 59 |
| requirements-test.txt | D | 03-May-2024 | 170 | 11 | 10 |
| setup.cfg | D | 03-May-2024 | 503 | 28 | 24 |
| setup.py | D | 03-May-2024 | 3.4 KiB | 108 | 77 |
README.md
1Introduction
2============
3
4httplib2 is a comprehensive HTTP client library, httplib2.py supports many
5features left out of other HTTP libraries.
6
7### HTTP and HTTPS
8
9HTTPS support is only available if the socket module was
10compiled with SSL support.
11
12### Keep-Alive
13
14Supports HTTP 1.1 Keep-Alive, keeping the socket open and
15performing multiple requests over the same connection if
16possible.
17
18### Authentication
19
20The following three types of HTTP Authentication are
21supported. These can be used over both HTTP and HTTPS.
22
23* Digest
24* Basic
25* WSSE
26
27### Caching
28
29The module can optionally operate with a private cache that
30understands the Cache-Control: header and uses both the ETag
31and Last-Modified cache validators.
32
33### All Methods
34
35The module can handle any HTTP request method, not just GET
36and POST.
37
38### Redirects
39
40Automatically follows 3XX redirects on GETs.
41
42### Compression
43
44Handles both 'deflate' and 'gzip' types of compression.
45
46### Lost update support
47
48Automatically adds back ETags into PUT requests to resources
49we have already cached. This implements Section 3.2 of
50Detecting the Lost Update Problem Using Unreserved Checkout.
51
52### Unit Tested
53
54A large and growing set of unit tests.
55
56
57Installation
58============
59
60
61 $ pip install httplib2
62
63
64Usage
65=====
66
67A simple retrieval:
68
69```python
70import httplib2
71h = httplib2.Http(".cache")
72(resp_headers, content) = h.request("http://example.org/", "GET")
73```
74
75The 'content' is the content retrieved from the URL. The content
76is already decompressed or unzipped if necessary.
77
78To PUT some content to a server that uses SSL and Basic authentication:
79
80```python
81import httplib2
82h = httplib2.Http(".cache")
83h.add_credentials('name', 'password')
84(resp, content) = h.request("https://example.org/chapter/2",
85 "PUT", body="This is text",
86 headers={'content-type':'text/plain'} )
87```
88
89Use the Cache-Control: header to control how the caching operates.
90
91```python
92import httplib2
93h = httplib2.Http(".cache")
94(resp, content) = h.request("http://bitworking.org/", "GET")
95...
96(resp, content) = h.request("http://bitworking.org/", "GET",
97 headers={'cache-control':'no-cache'})
98```
99
100The first request will be cached and since this is a request
101to bitworking.org it will be set to be cached for two hours,
102because that is how I have my server configured. Any subsequent
103GET to that URI will return the value from the on-disk cache
104and no request will be made to the server. You can use the
105Cache-Control: header to change the caches behavior and in
106this example the second request adds the Cache-Control:
107header with a value of 'no-cache' which tells the library
108that the cached copy must not be used when handling this request.
109
110More example usage can be found at:
111
112 * https://github.com/httplib2/httplib2/wiki/Examples
113 * https://github.com/httplib2/httplib2/wiki/Examples-Python3
114