Compare commits
5074 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3d7cf3f27 | ||
|
|
3c5ecfc9f5 | ||
|
|
d528106876 | ||
|
|
cbc7c2d1c9 | ||
|
|
e36083b89c | ||
|
|
308343508b | ||
|
|
ba21d14976 | ||
|
|
cee8fae65e | ||
|
|
1c2022cf86 | ||
|
|
8480cf937a | ||
|
|
f6952a9b8d | ||
|
|
d758f0cf97 | ||
|
|
c31a450c55 | ||
|
|
0a2dc74ecb | ||
|
|
f78a57936b | ||
|
|
218978601f | ||
|
|
cb9620780f | ||
|
|
963c78853f | ||
|
|
b670b61d54 | ||
|
|
9ec2005d9f | ||
|
|
f4ddf00c36 | ||
|
|
248f122970 | ||
|
|
be8ce365ab | ||
|
|
3393dc8221 | ||
|
|
7c67c4adf9 | ||
|
|
2a4dd64fb4 | ||
|
|
9e0fb37fff | ||
|
|
4f49f6b3ed | ||
|
|
8b3f20ca91 | ||
|
|
fdf426125b | ||
|
|
d6b57c6fb2 | ||
|
|
39b121d791 | ||
|
|
12c7456789 | ||
|
|
2629c0906e | ||
|
|
205755834d | ||
|
|
e2f5a135c3 | ||
|
|
8de858f0de | ||
|
|
667896c557 | ||
|
|
2b6f1e6236 | ||
|
|
b77c1a3deb | ||
|
|
9e8d403a21 | ||
|
|
6cc891fd32 | ||
|
|
49c44a0c08 | ||
|
|
c6e18b04e3 | ||
|
|
c10b8384e4 | ||
|
|
8d1228cd19 | ||
|
|
8e227aeb89 | ||
|
|
d8c2fdf92f | ||
|
|
cada19b300 | ||
|
|
c6a80640d1 | ||
|
|
649efc8c9b | ||
|
|
14176d1d63 | ||
|
|
1ea4e21958 | ||
|
|
51feabbc27 | ||
|
|
f6e07bb27f | ||
|
|
c054a722bb | ||
|
|
bbeb1c32d2 | ||
|
|
1263b8660d | ||
|
|
2fde9ee407 | ||
|
|
51de61f914 | ||
|
|
dd13b13479 | ||
|
|
d93b37cee7 | ||
|
|
a5b8f8d40a | ||
|
|
a8972a5bd2 | ||
|
|
bb4326c676 | ||
|
|
a0f0258eee | ||
|
|
c5901ac893 | ||
|
|
c6a6347156 | ||
|
|
132040cc03 | ||
|
|
613f61d77c | ||
|
|
edcc894a2e | ||
|
|
761e39b443 | ||
|
|
1d7fd6c8b3 | ||
|
|
b3d138e0fd | ||
|
|
8a8b71f786 | ||
|
|
2872f17ab8 | ||
|
|
22d12b0501 | ||
|
|
13eb907c48 | ||
|
|
d8e2367809 | ||
|
|
f8ccc60498 | ||
|
|
4f1b17c9c1 | ||
|
|
4847f5b8cd | ||
|
|
40ce8144d1 | ||
|
|
5a616ee980 | ||
|
|
b6ee4b2156 | ||
|
|
0abb69b1cb | ||
|
|
56971482af | ||
|
|
98bbf8d170 | ||
|
|
d3a4d06238 | ||
|
|
152faa2a0f | ||
|
|
e41c2c2d96 | ||
|
|
3ca2722802 | ||
|
|
310d7f8a9b | ||
|
|
01f982da50 | ||
|
|
ba509635a3 | ||
|
|
008ab18a77 | ||
|
|
67831abaaf | ||
|
|
0f57faba70 | ||
|
|
35f2e55308 | ||
|
|
77ae596e8b | ||
|
|
84114419a0 | ||
|
|
500fe3ee03 | ||
|
|
d78ec90e7b | ||
|
|
04ed1e5122 | ||
|
|
33619268f9 | ||
|
|
e5894e99b7 | ||
|
|
6495190b00 | ||
|
|
5b363d1a57 | ||
|
|
f6a4ab02da | ||
|
|
5fa4e74d61 | ||
|
|
7fc48b099e | ||
|
|
3fa02a1336 | ||
|
|
e55d3d0658 | ||
|
|
7c3861a322 | ||
|
|
7c2618eb82 | ||
|
|
4e1bbe1288 | ||
|
|
cfc3db06cf | ||
|
|
5091c15bd7 | ||
|
|
dcb8277975 | ||
|
|
412e3a20a9 | ||
|
|
17084cd6d8 | ||
|
|
1278ecdf71 | ||
|
|
2d763c90ae | ||
|
|
db076c098e | ||
|
|
588e8f7f64 | ||
|
|
593cd18202 | ||
|
|
2daf1cbad9 | ||
|
|
71d8f289b0 | ||
|
|
44c9b7e93b | ||
|
|
916d171f2b | ||
|
|
3857431159 | ||
|
|
4ad4670583 | ||
|
|
68076a7f81 | ||
|
|
86f8cb8a35 | ||
|
|
7f14db17c8 | ||
|
|
14c1102e0f | ||
|
|
c77911ca0f | ||
|
|
5a2e5af3a4 | ||
|
|
31fc69ec0d | ||
|
|
88b435e7e8 | ||
|
|
60226cc25c | ||
|
|
8ddba4662d | ||
|
|
cd2beaf04a | ||
|
|
58501d1ec7 | ||
|
|
beccd21146 | ||
|
|
0622b5c54e | ||
|
|
821774cf47 | ||
|
|
78349914c8 | ||
|
|
2ccecf6dbd | ||
|
|
8af1d9331f | ||
|
|
ef34a85378 | ||
|
|
55014bcc48 | ||
|
|
303eca03f3 | ||
|
|
e02eb69fcc | ||
|
|
2936a77678 | ||
|
|
e6e3589c36 | ||
|
|
c3a00771e3 | ||
|
|
16c8241a81 | ||
|
|
1dfa631dae | ||
|
|
1fa168eea4 | ||
|
|
8b5fa606ec | ||
|
|
148ab30d70 | ||
|
|
8d0c2537ee | ||
|
|
458008653c | ||
|
|
679d368e3e | ||
|
|
7384fe71d6 | ||
|
|
94331723d1 | ||
|
|
b565b79858 | ||
|
|
a00d14a61f | ||
|
|
dc70edf17d | ||
|
|
68fda6bcf2 | ||
|
|
141ce93445 | ||
|
|
6abe1ff933 | ||
|
|
3d425ac191 | ||
|
|
0ff28d7421 | ||
|
|
2758b8b0f0 | ||
|
|
6746b2540d | ||
|
|
03944f4cd6 | ||
|
|
4a28ffcfe9 | ||
|
|
b6d51d9f2b | ||
|
|
2edb553036 | ||
|
|
cffa0effe0 | ||
|
|
76a66c41d6 | ||
|
|
19a1379ff5 | ||
|
|
057689bb8a | ||
|
|
88f28325c9 | ||
|
|
62afdabb30 | ||
|
|
2468058fea | ||
|
|
e4d8571080 | ||
|
|
048997daa0 | ||
|
|
c166c4f5d4 | ||
|
|
f4b488b7f8 | ||
|
|
cd4c701186 | ||
|
|
8e93b100da | ||
|
|
276024b170 | ||
|
|
6af910610f | ||
|
|
1d76cb3572 | ||
|
|
03e5f5daf3 | ||
|
|
b9a004a22b | ||
|
|
2e67c86075 | ||
|
|
f0fb5034fc | ||
|
|
b0c19226c6 | ||
|
|
4e06345988 | ||
|
|
892fbe09f6 | ||
|
|
46a4e731da | ||
|
|
46a930941a | ||
|
|
c6827de846 | ||
|
|
5c65f6d01e | ||
|
|
7ce5ca853d | ||
|
|
0ae8524e3b | ||
|
|
bf4a813304 | ||
|
|
6d082ea972 | ||
|
|
f180980b28 | ||
|
|
a44284c045 | ||
|
|
c1f32f68f6 | ||
|
|
4c155de9fd | ||
|
|
03dd91093b | ||
|
|
d42556a936 | ||
|
|
103718847a | ||
|
|
28666e5d3a | ||
|
|
ecaa10543f | ||
|
|
908c3b01ee | ||
|
|
c952e9e4e0 | ||
|
|
cceceecb68 | ||
|
|
e9ca4b39b4 | ||
|
|
7962c12451 | ||
|
|
f687e9f3d8 | ||
|
|
dc24bc3217 | ||
|
|
267ec2f9c3 | ||
|
|
18c8924f14 | ||
|
|
413f2a557c | ||
|
|
04faf59f49 | ||
|
|
bcd0e170ac | ||
|
|
a6c3a0ca72 | ||
|
|
d2713412e5 | ||
|
|
2b34880e2f | ||
|
|
de035b56f9 | ||
|
|
1f6de03baf | ||
|
|
0d7de6430e | ||
|
|
a00b7e4b25 | ||
|
|
c49ce5ae0b | ||
|
|
6d3d5e59c9 | ||
|
|
af52bf795e | ||
|
|
f5f3e696ab | ||
|
|
47f170bb35 | ||
|
|
168109f13c | ||
|
|
8a2014e265 | ||
|
|
1d31b36148 | ||
|
|
6c41633cfd | ||
|
|
6ef7298466 | ||
|
|
818daff12a | ||
|
|
0bb200515c | ||
|
|
628633143d | ||
|
|
1ea27b3564 | ||
|
|
8e17600ef6 | ||
|
|
282b01a7c9 | ||
|
|
e1539ac8ff | ||
|
|
8c2a36140b | ||
|
|
60b9fb17af | ||
|
|
0aee483497 | ||
|
|
bf53ace6f8 | ||
|
|
4c3d307eb9 | ||
|
|
380d130245 | ||
|
|
c3367d1854 | ||
|
|
a7239aab84 | ||
|
|
dfd667df96 | ||
|
|
f41560c5d4 | ||
|
|
ce64cce14e | ||
|
|
60041f5169 | ||
|
|
14d6fa1472 | ||
|
|
64efd9cfe0 | ||
|
|
1001bc671a | ||
|
|
733ff4b8a4 | ||
|
|
296c215762 | ||
|
|
cc7b3ee7ed | ||
|
|
e038aad3cc | ||
|
|
4f8f4b5fb3 | ||
|
|
ce882a2eae | ||
|
|
f581dc95a9 | ||
|
|
7abfd92aea | ||
|
|
9fbfd22f6b | ||
|
|
e634ab73b2 | ||
|
|
3e32356716 | ||
|
|
539302a17d | ||
|
|
037108178c | ||
|
|
f3d310b299 | ||
|
|
874bca97cb | ||
|
|
dbb67a1310 | ||
|
|
a9470fe31f | ||
|
|
0ba21a79c4 | ||
|
|
66293b830a | ||
|
|
6fb9b1ce53 | ||
|
|
2772413f3d | ||
|
|
ba63e50ecd | ||
|
|
2c71f2d520 | ||
|
|
fb3f2a030f | ||
|
|
00c6ad58b7 | ||
|
|
af66521381 | ||
|
|
a8bfa82801 | ||
|
|
6ab6a18ab2 | ||
|
|
570c4c83a5 | ||
|
|
e2142a1e54 | ||
|
|
52a2efa2ae | ||
|
|
f88e573c18 | ||
|
|
da29295369 | ||
|
|
dbdbffd7f5 | ||
|
|
a3f2972c4f | ||
|
|
1553770014 | ||
|
|
37ef88885c | ||
|
|
2cb07872fe | ||
|
|
2667c772b9 | ||
|
|
0280a18b53 | ||
|
|
f4b90827b0 | ||
|
|
e4693eba4f | ||
|
|
2e496c3e1d | ||
|
|
f3f4c3e20a | ||
|
|
3618f3f68e | ||
|
|
f909314652 | ||
|
|
636082fa8f | ||
|
|
800a074b5d | ||
|
|
508d47dc6e | ||
|
|
bf1a2a4e39 | ||
|
|
ddada2d750 | ||
|
|
074c4a32d8 | ||
|
|
debc5de6d4 | ||
|
|
4bad52caa2 | ||
|
|
d49f3e258c | ||
|
|
823519d45c | ||
|
|
f8189eda10 | ||
|
|
3d813c9a7a | ||
|
|
379025a1bc | ||
|
|
176ba43869 | ||
|
|
7ae662dec9 | ||
|
|
216aee441d | ||
|
|
5c389cf3f5 | ||
|
|
1c38e1f5f6 | ||
|
|
4f34446b36 | ||
|
|
724fd44b97 | ||
|
|
26ab951300 | ||
|
|
eae38b8d13 | ||
|
|
fcc3b7d7b1 | ||
|
|
d89f8c0d70 | ||
|
|
8db8a7d82d | ||
|
|
84099eea9f | ||
|
|
19ba9f1097 | ||
|
|
44106f18b7 | ||
|
|
d0a072e15d | ||
|
|
fae7530a17 | ||
|
|
8d6f7e6854 | ||
|
|
f6c58ec582 | ||
|
|
047056c150 | ||
|
|
52a3526a99 | ||
|
|
af383b3968 | ||
|
|
524627ef21 | ||
|
|
fcb272cc36 | ||
|
|
b8674db246 | ||
|
|
722b1dae96 | ||
|
|
fd7dcd2785 | ||
|
|
a3e597c171 | ||
|
|
84a6040762 | ||
|
|
1cd173a82c | ||
|
|
f061fb7e28 | ||
|
|
ead8fba84b | ||
|
|
342096a3b9 | ||
|
|
1be6a17edc | ||
|
|
28768b945c | ||
|
|
93cb1ca763 | ||
|
|
1be8e19403 | ||
|
|
a63ae02e34 | ||
|
|
3cb7539981 | ||
|
|
4c13678587 | ||
|
|
1e7ae063ce | ||
|
|
fe58c6fdd6 | ||
|
|
a180db963f | ||
|
|
567e12bfb8 | ||
|
|
993cbf5741 | ||
|
|
4207867aaf | ||
|
|
42ec8b08f2 | ||
|
|
7d8b87c37f | ||
|
|
b60c5a5ed4 | ||
|
|
1cb759a9d9 | ||
|
|
552ab7a064 | ||
|
|
e0ba82949b | ||
|
|
29085e7d95 | ||
|
|
4acdb99752 | ||
|
|
c43fefa7ed | ||
|
|
2e9e944bc1 | ||
|
|
16f6e25176 | ||
|
|
62bd9247ba | ||
|
|
8e6e47af43 | ||
|
|
41a33f2e86 | ||
|
|
3e0d78fdaf | ||
|
|
eca8351491 | ||
|
|
21972c4601 | ||
|
|
3f3df8b5ff | ||
|
|
3d22f9f5ab | ||
|
|
2aaf6ac038 | ||
|
|
45a2977e1b | ||
|
|
c121b98c4e | ||
|
|
d6f4818c0b | ||
|
|
8e049bd9eb | ||
|
|
7a281e74ec | ||
|
|
e674aa1c8c | ||
|
|
3664682539 | ||
|
|
655f0edbb4 | ||
|
|
2414fa82c8 | ||
|
|
f47aff68f1 | ||
|
|
90f3842ed6 | ||
|
|
6cbebf782a | ||
|
|
f2fe735846 | ||
|
|
e7b7574cfe | ||
|
|
6bd6249051 | ||
|
|
453397965b | ||
|
|
70f31a3166 | ||
|
|
85400d8d67 | ||
|
|
ad65b0cb19 | ||
|
|
57659e5987 | ||
|
|
c134388a43 | ||
|
|
b41bb9ecb2 | ||
|
|
a3e671d717 | ||
|
|
7b190acf82 | ||
|
|
a0b97253c2 | ||
|
|
84749f08bc | ||
|
|
e63dd1a66b | ||
|
|
0bea453913 | ||
|
|
08ce652b8b | ||
|
|
5c68b8f227 | ||
|
|
571d2c2cd7 | ||
|
|
b00d8bf474 | ||
|
|
593734b770 | ||
|
|
af4052b020 | ||
|
|
f521a25970 | ||
|
|
62176a1ca7 | ||
|
|
f278344e01 | ||
|
|
c2c523ba9e | ||
|
|
abaeeb8807 | ||
|
|
6bd091ca70 | ||
|
|
260763a83d | ||
|
|
5ac53c69c7 | ||
|
|
8c6e9388e7 | ||
|
|
036b5d34fd | ||
|
|
f4a3aa42b6 | ||
|
|
1a4ba6c833 | ||
|
|
e84086ac86 | ||
|
|
8a58427d8a | ||
|
|
d3c97dda11 | ||
|
|
808e4c62dc | ||
|
|
23057dbc22 | ||
|
|
795106c188 | ||
|
|
b92058b6fe | ||
|
|
1da52c04d4 | ||
|
|
cf07efa534 | ||
|
|
9e681a4a9f | ||
|
|
efa030eae3 | ||
|
|
c008465d24 | ||
|
|
7cad64ac5a | ||
|
|
014ec0eb26 | ||
|
|
600ee2bf2b | ||
|
|
d291202db0 | ||
|
|
9a2a316f08 | ||
|
|
b12272d7d1 | ||
|
|
fee0e94a76 | ||
|
|
fc54869da0 | ||
|
|
6a415a02cf | ||
|
|
e3f89bf23c | ||
|
|
32548e2bb6 | ||
|
|
b2289cd2d5 | ||
|
|
4d00d47a5a | ||
|
|
af1b542e20 | ||
|
|
b5704a63ca | ||
|
|
df56f38bb4 | ||
|
|
304e4cb5ee | ||
|
|
c7a4819c84 | ||
|
|
e32e7108d0 | ||
|
|
97b5bc21d1 | ||
|
|
ed9004f30e | ||
|
|
ab3c21cf96 | ||
|
|
9c67691b90 | ||
|
|
03d96aa9f7 | ||
|
|
5b801847c4 | ||
|
|
8f6e990066 | ||
|
|
5eb2df1acf | ||
|
|
62b014560a | ||
|
|
73018f40a3 | ||
|
|
358bb766d0 | ||
|
|
2a2dd1389b | ||
|
|
8ae576193c | ||
|
|
c619bea722 | ||
|
|
c6973d31ca | ||
|
|
0938c9e985 | ||
|
|
bb6f5a1d93 | ||
|
|
efe0608cdd | ||
|
|
0ad2792873 | ||
|
|
c00783cd86 | ||
|
|
4c53915a21 | ||
|
|
5dcc039457 | ||
|
|
4ada39841b | ||
|
|
219d9a7297 | ||
|
|
160d364503 | ||
|
|
8344b0b409 | ||
|
|
5259966547 | ||
|
|
84ee1d4a42 | ||
|
|
23ac7256ea | ||
|
|
52b5ed18c1 | ||
|
|
a68f7169a5 | ||
|
|
65fb2a50c8 | ||
|
|
d374a182d9 | ||
|
|
115b438e6a | ||
|
|
96fbe9e8c9 | ||
|
|
a1d058c6b1 | ||
|
|
fae3f92c34 | ||
|
|
580b45dd3c | ||
|
|
2432dd6208 | ||
|
|
e2bd1f9100 | ||
|
|
e8c0a99cb1 | ||
|
|
1c69fc2108 | ||
|
|
775d19ee05 | ||
|
|
4942b40496 | ||
|
|
ba7101e2cd | ||
|
|
a43845e729 | ||
|
|
2bcaff99ea | ||
|
|
57933d4d45 | ||
|
|
f5c5536916 | ||
|
|
edf09ada17 | ||
|
|
33b29be8cf | ||
|
|
b9d282b6b7 | ||
|
|
0cb6ddaecf | ||
|
|
1c34ac3ae6 | ||
|
|
8e0a532cad | ||
|
|
5aa6661587 | ||
|
|
bc8b29099e | ||
|
|
c3fb8e020b | ||
|
|
789f21807d | ||
|
|
ba6e948835 | ||
|
|
ddde5cd85b | ||
|
|
5a280a11bc | ||
|
|
daebd6b807 | ||
|
|
e127ecab3f | ||
|
|
30bcd55fb9 | ||
|
|
1285f576ae | ||
|
|
9726f5314e | ||
|
|
1da1213561 | ||
|
|
4683f16990 | ||
|
|
fae6701478 | ||
|
|
449d74842d | ||
|
|
576b447a37 | ||
|
|
11a86a5651 | ||
|
|
13716728e7 | ||
|
|
14d71fd41a | ||
|
|
2d2c831d07 | ||
|
|
c398ab0e7d | ||
|
|
7d2dfa8684 | ||
|
|
6f659a4179 | ||
|
|
402a55b647 | ||
|
|
ca15d48087 | ||
|
|
5c4549493b | ||
|
|
36c9c8c3de | ||
|
|
f897be58bf | ||
|
|
dfad00a6e8 | ||
|
|
d5e050da85 | ||
|
|
1ec08bedd4 | ||
|
|
724ae1274e | ||
|
|
4f428228d7 | ||
|
|
ccabcf1fca | ||
|
|
4f9d0e0455 | ||
|
|
b9f1c448f7 | ||
|
|
22ec73d71a | ||
|
|
005f93fd0f | ||
|
|
34af72c87d | ||
|
|
a83685ce00 | ||
|
|
264f5bd5e1 | ||
|
|
d52e9b8c80 | ||
|
|
268672ab33 | ||
|
|
3b956495c1 | ||
|
|
3b84be3c99 | ||
|
|
e15280e49d | ||
|
|
55dea233ce | ||
|
|
4f0efdb77e | ||
|
|
7c4821231f | ||
|
|
bf3e960e15 | ||
|
|
53d4a1feee | ||
|
|
ed3ba3dbb8 | ||
|
|
37bde4b638 | ||
|
|
5562c0f097 | ||
|
|
2185fac626 | ||
|
|
329a5cfdd4 | ||
|
|
5b66b364a7 | ||
|
|
5f4d0d08de | ||
|
|
7e138f945e | ||
|
|
1e198f9115 | ||
|
|
be8b13e89b | ||
|
|
0d7de50dbd | ||
|
|
248d3e9f0f | ||
|
|
eb39a557bd | ||
|
|
e7a6893282 | ||
|
|
c2688bbf27 | ||
|
|
e1b5e19c78 | ||
|
|
7f2a4151f7 | ||
|
|
9ec3478469 | ||
|
|
341f288449 | ||
|
|
3ea3324434 | ||
|
|
b4d843bad2 | ||
|
|
eaf9a688c5 | ||
|
|
9a0a6cab55 | ||
|
|
87b7914bb2 | ||
|
|
512a78173a | ||
|
|
5bb01fbfe8 | ||
|
|
362da46e9a | ||
|
|
2d211d59a0 | ||
|
|
72d69d7b62 | ||
|
|
99fa7becf2 | ||
|
|
e2408fce9d | ||
|
|
cfb7fd8f28 | ||
|
|
33bd38be15 | ||
|
|
d81ad06c64 | ||
|
|
71b8941f0e | ||
|
|
e514920e19 | ||
|
|
70f1f8ed35 | ||
|
|
a49c387b7a | ||
|
|
d24da4a953 | ||
|
|
340902153f | ||
|
|
80634b2fad | ||
|
|
f72684e13c | ||
|
|
623d9e7878 | ||
|
|
87e40d116f | ||
|
|
b5ca0c8d58 | ||
|
|
522d37c959 | ||
|
|
38dd089c5f | ||
|
|
9849c27b70 | ||
|
|
40402cd0dd | ||
|
|
bf19750c0a | ||
|
|
c97a530638 | ||
|
|
7eaa5ee37f | ||
|
|
388e949e83 | ||
|
|
595a409a18 | ||
|
|
390a499e81 | ||
|
|
dfd85f2099 | ||
|
|
9deb603dc3 | ||
|
|
548a03acef | ||
|
|
50486cf2be | ||
|
|
d14401f799 | ||
|
|
d587533446 | ||
|
|
83fcabc5bd | ||
|
|
e7f5bd634d | ||
|
|
41b4658738 | ||
|
|
f5b5c293b9 | ||
|
|
b8f4c7c7ff | ||
|
|
c13e313f5a | ||
|
|
8dd51d22fc | ||
|
|
ae82300073 | ||
|
|
f19d30a670 | ||
|
|
110684ea02 | ||
|
|
9337b4d95d | ||
|
|
49b69b57db | ||
|
|
27812eb902 | ||
|
|
35056b1de6 | ||
|
|
3c680cc1c6 | ||
|
|
dfb4ef7be0 | ||
|
|
8f37cf79c3 | ||
|
|
45478d5be1 | ||
|
|
d0f7a51dd8 | ||
|
|
02ab1ba5bd | ||
|
|
341bed9e17 | ||
|
|
7322a09379 | ||
|
|
327512f5ef | ||
|
|
022e23c977 | ||
|
|
5c15fffaca | ||
|
|
1ac56f1343 | ||
|
|
ed0570bc2b | ||
|
|
06920cc266 | ||
|
|
5eabcb7a2f | ||
|
|
087aeacee5 | ||
|
|
3ac70defff | ||
|
|
9a0b392dee | ||
|
|
f002b73026 | ||
|
|
ae83352bbd | ||
|
|
2af059797a | ||
|
|
550dc19099 | ||
|
|
01e405c611 | ||
|
|
b28531f4bb | ||
|
|
439451c3d4 | ||
|
|
9407d697c8 | ||
|
|
31b35ab838 | ||
|
|
08a158f486 | ||
|
|
ddf7df9b00 | ||
|
|
c12122970a | ||
|
|
d7227fbb7e | ||
|
|
5524472cc7 | ||
|
|
39e8c0d96f | ||
|
|
2041adbe4d | ||
|
|
42d4eaf6ea | ||
|
|
87f96936fe | ||
|
|
2e1086f5b4 | ||
|
|
39b3477726 | ||
|
|
dedf9064c6 | ||
|
|
cd056cd621 | ||
|
|
58d855e193 | ||
|
|
80f304fd30 | ||
|
|
889f855581 | ||
|
|
2cd05271be | ||
|
|
f5c59743e7 | ||
|
|
99364b6b0b | ||
|
|
8873a09097 | ||
|
|
d4965a4ec6 | ||
|
|
af7729f64a | ||
|
|
52b15f811f | ||
|
|
7c80222afa | ||
|
|
3314259185 | ||
|
|
77b068bb9e | ||
|
|
647ed5b6de | ||
|
|
117813ee2e | ||
|
|
d3567aacc9 | ||
|
|
33501c7ae8 | ||
|
|
532756803d | ||
|
|
b5fac31688 | ||
|
|
04fdf1a25a | ||
|
|
b26606cc3c | ||
|
|
13bc52f82c | ||
|
|
b9648bad19 | ||
|
|
786fb19a6d | ||
|
|
ab1a6a4d00 | ||
|
|
1435cf5aff | ||
|
|
f12166acb6 | ||
|
|
00f83fb0c6 | ||
|
|
59f12c9669 | ||
|
|
f5ff345c35 | ||
|
|
4d5091c287 | ||
|
|
e50c61bc86 | ||
|
|
c1d7d23b74 | ||
|
|
10bc2f05d3 | ||
|
|
e4b7040530 | ||
|
|
1e253cd0b3 | ||
|
|
5e4abfa3a2 | ||
|
|
d7f56ba938 | ||
|
|
5259b37451 | ||
|
|
542fbbc67f | ||
|
|
931397829e | ||
|
|
64c9451657 | ||
|
|
5f7b8ab0a7 | ||
|
|
33a74f1787 | ||
|
|
bab4aa0fbf | ||
|
|
57e7a308b0 | ||
|
|
a2e41ba1f1 | ||
|
|
05d90b9379 | ||
|
|
d7700bebeb | ||
|
|
c6eea58081 | ||
|
|
7bf67b4101 | ||
|
|
cf7fdb901c | ||
|
|
07b7872df8 | ||
|
|
be12b27d71 | ||
|
|
c69e3eed31 | ||
|
|
f40764c01b | ||
|
|
5453b88f8f | ||
|
|
fb01456061 | ||
|
|
b7809acb47 | ||
|
|
4285bac3fd | ||
|
|
2d4a89f5dc | ||
|
|
15a3869006 | ||
|
|
75d72ca4ea | ||
|
|
d262df99bf | ||
|
|
d7fc5d5296 | ||
|
|
5a3aeedd18 | ||
|
|
6e54fd607f | ||
|
|
cf938420f8 | ||
|
|
425962cb13 | ||
|
|
5d9b9ffab4 | ||
|
|
1cb3b797fe | ||
|
|
be31a90906 | ||
|
|
7700ecae14 | ||
|
|
71050e9ab9 | ||
|
|
bd9e8f2271 | ||
|
|
2669ab797c | ||
|
|
ebadf81723 | ||
|
|
0c08ca7154 | ||
|
|
0bcf634135 | ||
|
|
92fe51c0af | ||
|
|
36453b95b1 | ||
|
|
cf3c99890d | ||
|
|
1f681d8843 | ||
|
|
8484144c67 | ||
|
|
771ecd7efd | ||
|
|
400d27f982 | ||
|
|
e12ee9407c | ||
|
|
6c9a0eff04 | ||
|
|
7d0a94d8c6 | ||
|
|
6f5b6bd4c4 | ||
|
|
277d4a41ad | ||
|
|
7a404cf4ec | ||
|
|
8813787a12 | ||
|
|
bca205e9bf | ||
|
|
de4c75bbad | ||
|
|
5e86103387 | ||
|
|
9e9d2c6521 | ||
|
|
49b69c4751 | ||
|
|
b6d6894f53 | ||
|
|
cd4e6b9aef | ||
|
|
35744c3e5d | ||
|
|
12e3631827 | ||
|
|
b94decc47c | ||
|
|
f59a95713e | ||
|
|
17b6c5742c | ||
|
|
4bf8866172 | ||
|
|
4865f0f9bf | ||
|
|
0838685dab | ||
|
|
1121f8b915 | ||
|
|
87704105af | ||
|
|
cb4c2c0b65 | ||
|
|
3669b4216a | ||
|
|
04bb965c87 | ||
|
|
52c0daff5f | ||
|
|
9ff2e43cd6 | ||
|
|
386382b18c | ||
|
|
989e8f15dd | ||
|
|
339e950dc7 | ||
|
|
52facb2257 | ||
|
|
296928f36f | ||
|
|
efb4af0127 | ||
|
|
f69d8c16ed | ||
|
|
a5da4f399f | ||
|
|
39d6935488 | ||
|
|
c9ef5653cc | ||
|
|
2824867412 | ||
|
|
f803dc6c99 | ||
|
|
ce5e312593 | ||
|
|
ecebf337ed | ||
|
|
abe02ed89f | ||
|
|
252bfa7885 | ||
|
|
70a344d8eb | ||
|
|
343027893b | ||
|
|
4e7beef860 | ||
|
|
bbeb0001cd | ||
|
|
ae1ac2d4e0 | ||
|
|
aa1c3adf9a | ||
|
|
b1a7dcd799 | ||
|
|
d801d7797e | ||
|
|
60aee145b9 | ||
|
|
2029a8a931 | ||
|
|
c8a0fc6aa2 | ||
|
|
4f5741e1ff | ||
|
|
4c04469cfb | ||
|
|
4a716e0dfc | ||
|
|
634b2beb39 | ||
|
|
e65d6fc637 | ||
|
|
b5d375417f | ||
|
|
2981366f56 | ||
|
|
2874fd18fe | ||
|
|
219490ea7f | ||
|
|
fb230709a8 | ||
|
|
2246a52a36 | ||
|
|
831d8e0a1e | ||
|
|
f0860bd3ca | ||
|
|
456be3cfde | ||
|
|
b6b1b3a81c | ||
|
|
90578795eb | ||
|
|
03ed671a41 | ||
|
|
e576f98429 | ||
|
|
b8a577050d | ||
|
|
3acf3a7238 | ||
|
|
f24d56a1ce | ||
|
|
6ca9d71bb5 | ||
|
|
c9f8414476 | ||
|
|
e94c812c2d | ||
|
|
81dc9084b2 | ||
|
|
eddea4e914 | ||
|
|
1eb153529a | ||
|
|
190cddd4ae | ||
|
|
90a166d44a | ||
|
|
3a26d13b52 | ||
|
|
fe475f5d46 | ||
|
|
f0d5a1f230 | ||
|
|
ee060ba7f3 | ||
|
|
b473440cc1 | ||
|
|
6cc0b56d51 | ||
|
|
e034dd1140 | ||
|
|
4f378b0e1a | ||
|
|
f74a6707af | ||
|
|
c53a685e7d | ||
|
|
03743b15ed | ||
|
|
0dff06a7b9 | ||
|
|
c4abb4c9fb | ||
|
|
94d4818fde | ||
|
|
eeafdc143b | ||
|
|
66c52c3ce0 | ||
|
|
3c3bde5381 | ||
|
|
4edf1ae55f | ||
|
|
7088c06d8d | ||
|
|
b9517a58bc | ||
|
|
d8b36c1718 | ||
|
|
1185d65202 | ||
|
|
44161ac373 | ||
|
|
0d1a779030 | ||
|
|
bf026e3c31 | ||
|
|
e3ad31f3be | ||
|
|
f17ef753d2 | ||
|
|
567b31080e | ||
|
|
75a9a981b5 | ||
|
|
ca35c847a2 | ||
|
|
141db281d1 | ||
|
|
9ac5a6e4ae | ||
|
|
241656355b | ||
|
|
fa91b0ab7c | ||
|
|
46184236dc | ||
|
|
7c5d703466 | ||
|
|
f8798a253a | ||
|
|
7de1495bf5 | ||
|
|
c4adf614a6 | ||
|
|
f90c311851 | ||
|
|
f2ec732ce8 | ||
|
|
e47e80b92f | ||
|
|
5f06b8196e | ||
|
|
41c26ce1f5 | ||
|
|
75096a167c | ||
|
|
b366ef039c | ||
|
|
fc1e9b46a1 | ||
|
|
a7b5e3191d | ||
|
|
ca303cda0a | ||
|
|
1b1f4ac77d | ||
|
|
d8bf59dde4 | ||
|
|
14a83339a7 | ||
|
|
b70136cf52 | ||
|
|
f653b9ac58 | ||
|
|
1cf1699e37 | ||
|
|
8dc5f68bc1 | ||
|
|
29b191b5ea | ||
|
|
ee024423a5 | ||
|
|
90ddeca70d | ||
|
|
f123f89d32 | ||
|
|
5d0ffd85ce | ||
|
|
2cb052aa95 | ||
|
|
886f92324a | ||
|
|
d3bd9f30a6 | ||
|
|
688a00c386 | ||
|
|
f63106005b | ||
|
|
f8af499700 | ||
|
|
f4445b3d4f | ||
|
|
bf8c8312dd | ||
|
|
f4f863f168 | ||
|
|
f422ace07e | ||
|
|
60b591eaac | ||
|
|
dbefff6821 | ||
|
|
e98d71de13 | ||
|
|
45992769b2 | ||
|
|
47fa07dcd8 | ||
|
|
f6252c2203 | ||
|
|
c1c393122d | ||
|
|
9f33a0cd3c | ||
|
|
b0704b86de | ||
|
|
057722af23 | ||
|
|
169b7edcc3 | ||
|
|
283491f8b6 | ||
|
|
a3ded28c57 | ||
|
|
2fa5fa6ac5 | ||
|
|
476938ab8d | ||
|
|
3a77b59df2 | ||
|
|
00c0a80e6b | ||
|
|
087de5232c | ||
|
|
fc512d8924 | ||
|
|
bbadf47a8f | ||
|
|
18b26d20f7 | ||
|
|
6143b7eebc | ||
|
|
1c5c6eeb7a | ||
|
|
7461371361 | ||
|
|
20290e3f2c | ||
|
|
87f04e2a32 | ||
|
|
54d3b59f89 | ||
|
|
ba2b355168 | ||
|
|
fbe104876e | ||
|
|
4d97b5b39a | ||
|
|
9057f7539b | ||
|
|
9c939ec026 | ||
|
|
72d8293e08 | ||
|
|
33d2ba961b | ||
|
|
ab22b3ea5f | ||
|
|
c003797319 | ||
|
|
52054be612 | ||
|
|
f997c0590f | ||
|
|
8c963b52ea | ||
|
|
4095b26f13 | ||
|
|
2d0d291f5a | ||
|
|
20b4bb7c36 | ||
|
|
b1e97650f7 | ||
|
|
6e35ec4c12 | ||
|
|
90688c68ad | ||
|
|
458cb64e3d | ||
|
|
5481db22b5 | ||
|
|
6c2942b198 | ||
|
|
b782e66462 | ||
|
|
ed8cfd33e6 | ||
|
|
2140c98fa4 | ||
|
|
3f725bc226 | ||
|
|
0d25f8a00c | ||
|
|
6195edc075 | ||
|
|
f7447d1871 | ||
|
|
3f8b1fb617 | ||
|
|
a02069ec9e | ||
|
|
645ac3087f | ||
|
|
5887b136e3 | ||
|
|
00fa5f171c | ||
|
|
75c7e5f1c3 | ||
|
|
ceb88ac077 | ||
|
|
d76f304462 | ||
|
|
56a1b55a42 | ||
|
|
1f05867493 | ||
|
|
6a8a480d6c | ||
|
|
8b92d9989b | ||
|
|
5f2fef5bb5 | ||
|
|
5a18066c45 | ||
|
|
e6f218f3f6 | ||
|
|
6592dbc29b | ||
|
|
851d65efb7 | ||
|
|
7250665297 | ||
|
|
f9d5cbe5b5 | ||
|
|
07d8c28a75 | ||
|
|
820d31d5e2 | ||
|
|
fe0850f341 | ||
|
|
06df08e676 | ||
|
|
a3acd30bcc | ||
|
|
e4d15c4649 | ||
|
|
11b9b24ac9 | ||
|
|
1c54014daf | ||
|
|
39ee5d46dc | ||
|
|
08364c6739 | ||
|
|
396963ac7e | ||
|
|
cd84b3ff94 | ||
|
|
cbb0830ee9 | ||
|
|
f14f30817e | ||
|
|
a1c9b8439c | ||
|
|
fcb8c8d33b | ||
|
|
1108058626 | ||
|
|
06a411c289 | ||
|
|
728c318080 | ||
|
|
6e0649d9f8 | ||
|
|
46b7f19857 | ||
|
|
834a9601c3 | ||
|
|
b444f21b1f | ||
|
|
589f13ca9d | ||
|
|
f7cb796241 | ||
|
|
96a068b58e | ||
|
|
b32c3bc10f | ||
|
|
fc8fa1aa26 | ||
|
|
5f7a3a74aa | ||
|
|
046a0f215d | ||
|
|
424fe263d8 | ||
|
|
2f744b5010 | ||
|
|
3c0f0b9ab5 | ||
|
|
3d33f30436 | ||
|
|
9aca57d4bf | ||
|
|
9a20afd6b5 | ||
|
|
2d91365cba | ||
|
|
3ad66349ea | ||
|
|
534ee814fc | ||
|
|
3eeea3771b | ||
|
|
578b032555 | ||
|
|
4a41c591f8 | ||
|
|
3b2a489e13 | ||
|
|
e48fea7fb3 | ||
|
|
5c19d3e07b | ||
|
|
4d5e534467 | ||
|
|
6e903de068 | ||
|
|
40ce36671c | ||
|
|
5ecf789a6f | ||
|
|
aac32ac56e | ||
|
|
6551c290fd | ||
|
|
dfa97addcc | ||
|
|
23d9b077d8 | ||
|
|
6cfe6e775f | ||
|
|
27f5a15364 | ||
|
|
6adabacd81 | ||
|
|
b4b4661f46 | ||
|
|
f7917c305a | ||
|
|
11ad502b80 | ||
|
|
2ad3f07982 | ||
|
|
ab0f063d85 | ||
|
|
47e96c4e57 | ||
|
|
b806ce15ba | ||
|
|
9a2cc99b06 | ||
|
|
c1f51fd100 | ||
|
|
68db4132e3 | ||
|
|
99825de025 | ||
|
|
4c82dbab6f | ||
|
|
6f6b2fd1d5 | ||
|
|
6506dc8f66 | ||
|
|
085a8768a2 | ||
|
|
e5d6630888 | ||
|
|
6c47a0c5e9 | ||
|
|
6597b53834 | ||
|
|
2128321b85 | ||
|
|
de2a5f4332 | ||
|
|
6d0017ee6a | ||
|
|
5397ef71b3 | ||
|
|
0a1aaca024 | ||
|
|
4e89ba7077 | ||
|
|
f835843f87 | ||
|
|
cf9da5b52e | ||
|
|
d849d6e907 | ||
|
|
89178ebcdc | ||
|
|
a25a641fb4 | ||
|
|
35170e180e | ||
|
|
7d5d067e9c | ||
|
|
c1c164ba80 | ||
|
|
02576ae7e7 | ||
|
|
1ced0040bd | ||
|
|
e67cd15bc8 | ||
|
|
f7e0494130 | ||
|
|
43b90d7f72 | ||
|
|
7c91e27d01 | ||
|
|
15cf19431a | ||
|
|
be564e500c | ||
|
|
70d7b134c8 | ||
|
|
a8fdba15b1 | ||
|
|
3bc189b0af | ||
|
|
9b63f9cd37 | ||
|
|
f52287d999 | ||
|
|
a56db9ecc4 | ||
|
|
e5053cd322 | ||
|
|
de53523bef | ||
|
|
0352ec0bd3 | ||
|
|
4dffe5efaa | ||
|
|
8f460faa31 | ||
|
|
7dd94941c8 | ||
|
|
d290a9b4c6 | ||
|
|
f1fd11e54f | ||
|
|
1dff6c9153 | ||
|
|
edc68a0ac8 | ||
|
|
13ea7394cc | ||
|
|
b675377dc2 | ||
|
|
58b20d671c | ||
|
|
8f591682e6 | ||
|
|
6c2d09dc2f | ||
|
|
d8f28f4bca | ||
|
|
7c55446b7e | ||
|
|
18a6b60110 | ||
|
|
14a555ac71 | ||
|
|
2df3c7c75d | ||
|
|
b071c49556 | ||
|
|
978a89d5a3 | ||
|
|
931fd0eece | ||
|
|
3948a9562d | ||
|
|
2da8a604d3 | ||
|
|
f7be4e5f28 | ||
|
|
23051979f4 | ||
|
|
e499b354c4 | ||
|
|
ba7d09354a | ||
|
|
96e9490100 | ||
|
|
397f10bac7 | ||
|
|
8dcd9f12de | ||
|
|
09bd3232dd | ||
|
|
4e44c2ab64 | ||
|
|
d996a95cf7 | ||
|
|
f6afa71281 | ||
|
|
2a635ba87d | ||
|
|
8963e1567b | ||
|
|
f7a43e2664 | ||
|
|
139418475c | ||
|
|
a89d5c003a | ||
|
|
086e19d8e1 | ||
|
|
443d07e0d3 | ||
|
|
3c6f89b8f4 | ||
|
|
63b3b9be55 | ||
|
|
610fbd062f | ||
|
|
bf38d5bf52 | ||
|
|
aead8c347c | ||
|
|
79675a0638 | ||
|
|
21bf8cd9bf | ||
|
|
76a0d3fcb9 | ||
|
|
b8df8911c3 | ||
|
|
46ff1a9a54 | ||
|
|
649aeaa489 | ||
|
|
9d69c7845d | ||
|
|
c5a41269d9 | ||
|
|
7c74050d66 | ||
|
|
2cee3bb57a | ||
|
|
17a9e6da9e | ||
|
|
e9c94e0f06 | ||
|
|
ebc38f7825 | ||
|
|
96e8e8b92f | ||
|
|
1f48a4c9ea | ||
|
|
7a0cd16c1a | ||
|
|
37037607b5 | ||
|
|
56ecdebcc5 | ||
|
|
14ee84b5fd | ||
|
|
f4eaefa63e | ||
|
|
704a922fc2 | ||
|
|
719c76cd9d | ||
|
|
7c958ee28e | ||
|
|
bf9e66364f | ||
|
|
00d8c24fe1 | ||
|
|
4c6540898c | ||
|
|
f3d4480a33 | ||
|
|
fb496e4e86 | ||
|
|
c80121df91 | ||
|
|
500f15da1f | ||
|
|
2c8721540a | ||
|
|
d7a3aa6188 | ||
|
|
bf436ea0a4 | ||
|
|
a2e828d4d7 | ||
|
|
22075f02d0 | ||
|
|
618514231b | ||
|
|
56844d1287 | ||
|
|
e57925223f | ||
|
|
66567e037b | ||
|
|
767cc9d2dc | ||
|
|
8b03cd96cb | ||
|
|
48fe34447d | ||
|
|
cef2589436 | ||
|
|
9d88810d52 | ||
|
|
5d6d1bc284 | ||
|
|
4947cd01ae | ||
|
|
c7c26fb8eb | ||
|
|
7197afa887 | ||
|
|
3cf4ec41b9 | ||
|
|
2411b1f56a | ||
|
|
53ea23128e | ||
|
|
fdc76f12e5 | ||
|
|
f40bd0f707 | ||
|
|
98a59e4894 | ||
|
|
b1de7e7287 | ||
|
|
5a9097dc4b | ||
|
|
b6127ca9ca | ||
|
|
408d75d47a | ||
|
|
1bb91653cc | ||
|
|
313143959e | ||
|
|
8f3ddbeefb | ||
|
|
75c1776bde | ||
|
|
5d7392f140 | ||
|
|
276202f51e | ||
|
|
9b067db19e | ||
|
|
e8a4784c8f | ||
|
|
9648301e1e | ||
|
|
6648defcdd | ||
|
|
873f834fc9 | ||
|
|
31817b66c6 | ||
|
|
b4c1feac43 | ||
|
|
b8a297baab | ||
|
|
d0aecb271f | ||
|
|
d7026bfb2a | ||
|
|
2b5cdc56f3 | ||
|
|
77d7e53c12 | ||
|
|
1e640c8456 | ||
|
|
5ec7576f23 | ||
|
|
0be38a0c37 | ||
|
|
beaa7e4180 | ||
|
|
2b26489f74 | ||
|
|
3b325f1bc5 | ||
|
|
47e71d1774 | ||
|
|
147a305da8 | ||
|
|
2440b6f089 | ||
|
|
e9a1e35f89 | ||
|
|
e4d59bedfd | ||
|
|
884cb7a7fb | ||
|
|
a560e09427 | ||
|
|
f5dacf8446 | ||
|
|
e3bdec5934 | ||
|
|
9bbab338fd | ||
|
|
2e62df456a | ||
|
|
8b5e457b75 | ||
|
|
fd31453aa2 | ||
|
|
a92a2a4263 | ||
|
|
7ba130a0cb | ||
|
|
dfdf371a0f | ||
|
|
f608547bef | ||
|
|
1da62a65d9 | ||
|
|
8d0889b91b | ||
|
|
3c850b3339 | ||
|
|
d249c0a9c6 | ||
|
|
d866d8a44d | ||
|
|
ab1f493c8b | ||
|
|
dd0f164f8e | ||
|
|
059e105f8f | ||
|
|
395a3e8885 | ||
|
|
d3bd3630ee | ||
|
|
639f8347a3 | ||
|
|
553907aa6b | ||
|
|
fb6dade63d | ||
|
|
cda95d3cde | ||
|
|
c3c4c96a95 | ||
|
|
86aff09103 | ||
|
|
4505f71829 | ||
|
|
c6c8d649af | ||
|
|
868625532d | ||
|
|
74609c5c8f | ||
|
|
ab84f9be57 | ||
|
|
3475399a47 | ||
|
|
a6937534ce | ||
|
|
ba7975fd16 | ||
|
|
b7bd297340 | ||
|
|
ee7389da98 | ||
|
|
6acca21bae | ||
|
|
6e9ebc06d1 | ||
|
|
ff71b25efc | ||
|
|
c8004e3dd7 | ||
|
|
e859204554 | ||
|
|
5d722bd0f5 | ||
|
|
1f85ce8670 | ||
|
|
51938de6b7 | ||
|
|
535c51f548 | ||
|
|
09023f5894 | ||
|
|
9dba203952 | ||
|
|
f74fc486be | ||
|
|
773e730d80 | ||
|
|
93216afbaf | ||
|
|
b7fc3a1250 | ||
|
|
ca66267d2c | ||
|
|
73b9b6906d | ||
|
|
3880cf1255 | ||
|
|
ae7c28eb8e | ||
|
|
3e3fc7683c | ||
|
|
3d339ed7e6 | ||
|
|
cfb9e66b04 | ||
|
|
5fcd843eb2 | ||
|
|
1f0e5775f2 | ||
|
|
4cfc5bcd96 | ||
|
|
b906c04a6f | ||
|
|
35045e851a | ||
|
|
16eeee1436 | ||
|
|
576e18a796 | ||
|
|
d0e64d32ba | ||
|
|
a0d9e0bc57 | ||
|
|
5a799dd0f5 | ||
|
|
8cf5e67041 | ||
|
|
a0632d8df0 | ||
|
|
5478dd6271 | ||
|
|
599f834351 | ||
|
|
f02d0f9e79 | ||
|
|
f89b5a5d90 | ||
|
|
0cd9f5855e | ||
|
|
ccc03b93ef | ||
|
|
b0c008c593 | ||
|
|
a57c87a459 | ||
|
|
e3c7b43fc9 | ||
|
|
956ec8321a | ||
|
|
0581f2c7d2 | ||
|
|
1ff9a05181 | ||
|
|
36093e69c7 | ||
|
|
dacf69a16d | ||
|
|
1b5bfe681b | ||
|
|
18e678c1f8 | ||
|
|
1b1866934b | ||
|
|
5a69137ac8 | ||
|
|
36dea43406 | ||
|
|
d294de38c4 | ||
|
|
142e24de7b | ||
|
|
898465756a | ||
|
|
e8d9bc55bc | ||
|
|
e65360dbaf | ||
|
|
845e8f943f | ||
|
|
0ad075c430 | ||
|
|
460caf71a4 | ||
|
|
452ba32edf | ||
|
|
587eb193dd | ||
|
|
1145fe64a5 | ||
|
|
ce234d53a5 | ||
|
|
e95e173b8c | ||
|
|
b2ce5be9d0 | ||
|
|
a0f5776f35 | ||
|
|
1b5317ea08 | ||
|
|
8dda20f8e3 | ||
|
|
54791d1970 | ||
|
|
b7e3370762 | ||
|
|
84cc36017a | ||
|
|
bedd2be0a7 | ||
|
|
b974cd3741 | ||
|
|
86f9b1616a | ||
|
|
dfa0a2925f | ||
|
|
81d2d5535a | ||
|
|
cd3f7eb388 | ||
|
|
3711e04f37 | ||
|
|
8c6d82a244 | ||
|
|
3385c78999 | ||
|
|
6e2f1eb402 | ||
|
|
fa338da717 | ||
|
|
80a3e87bf3 | ||
|
|
bbbd9de6fd | ||
|
|
e776bb2656 | ||
|
|
f7c85685a8 | ||
|
|
8a2fd7ce6d | ||
|
|
76f7ce8a24 | ||
|
|
573d460aa7 | ||
|
|
3bd8afbff2 | ||
|
|
1acc4992d4 | ||
|
|
bc746e158c | ||
|
|
c4bd6ea150 | ||
|
|
9adaae6785 | ||
|
|
a0790f37b7 | ||
|
|
14b653ab3c | ||
|
|
4497a26c37 | ||
|
|
62200cb07e | ||
|
|
c53aa08cce | ||
|
|
bcfcd9f980 | ||
|
|
ec700a9a13 | ||
|
|
e7ac8ea0c1 | ||
|
|
39e49e5fb9 | ||
|
|
61f4faae70 | ||
|
|
1887f32b17 | ||
|
|
326f77d57c | ||
|
|
11b12c3e07 | ||
|
|
2669f0c0b1 | ||
|
|
9d8a57f2a2 | ||
|
|
6ea3f2ada8 | ||
|
|
461b740db6 | ||
|
|
628474d626 | ||
|
|
de674fc82c | ||
|
|
b58318163c | ||
|
|
d8be2473d1 | ||
|
|
58e513579a | ||
|
|
0b6d2e451b | ||
|
|
6f3c91b834 | ||
|
|
ed73d9e45d | ||
|
|
5a22d2060f | ||
|
|
344b51327c | ||
|
|
62df872871 | ||
|
|
a5a314e8ee | ||
|
|
b86330d1f1 | ||
|
|
69d9594338 | ||
|
|
291b6b24b7 | ||
|
|
426493f388 | ||
|
|
80aee7a225 | ||
|
|
ced6550a25 | ||
|
|
c7beb703bf | ||
|
|
53f33eb473 | ||
|
|
69b7c45c2e | ||
|
|
e644857877 | ||
|
|
3a5e2b2f3d | ||
|
|
02f852cc41 | ||
|
|
ff56e431ad | ||
|
|
b137472936 | ||
|
|
383b20b023 | ||
|
|
3314eb9a62 | ||
|
|
cf3a7f4945 | ||
|
|
fb1971778f | ||
|
|
2f7f6a57f3 | ||
|
|
74d85d0a2f | ||
|
|
eec44dbbb1 | ||
|
|
677bbe30d7 | ||
|
|
f37fe551bb | ||
|
|
751b35c346 | ||
|
|
d2d576b6b1 | ||
|
|
a57eacf080 | ||
|
|
b176ccd481 | ||
|
|
176b365287 | ||
|
|
09658b80c0 | ||
|
|
ac34e3b346 | ||
|
|
5549f50258 | ||
|
|
15597c27cd | ||
|
|
673bd6afce | ||
|
|
7612015424 | ||
|
|
892f2560c1 | ||
|
|
2d1ffad80b | ||
|
|
101425ebfc | ||
|
|
f4ec3d2309 | ||
|
|
b83131779c | ||
|
|
ce5b5fe227 | ||
|
|
eccbf4a412 | ||
|
|
86c3ecfd34 | ||
|
|
bd3cf95e34 | ||
|
|
386c589ba0 | ||
|
|
f723ab538f | ||
|
|
925e975295 | ||
|
|
4c61fef13f | ||
|
|
39090cfba6 | ||
|
|
d7c0249aa8 | ||
|
|
01b58ba04e | ||
|
|
a8205bb509 | ||
|
|
da82fb4b1d | ||
|
|
e8d02ea0bb | ||
|
|
d615405519 | ||
|
|
e23bf10cf4 | ||
|
|
508f4b1ca5 | ||
|
|
1d9bf43def | ||
|
|
bf2e73522f | ||
|
|
4e90aa7bd0 | ||
|
|
f172b30356 | ||
|
|
33b25176b8 | ||
|
|
9a0ce93935 | ||
|
|
cf82d4406b | ||
|
|
90857b8b59 | ||
|
|
7aa6c62d6d | ||
|
|
53d02381e2 | ||
|
|
8ae4d02d73 | ||
|
|
1c4a666b16 | ||
|
|
2a5364cf72 | ||
|
|
c8baf88125 | ||
|
|
3246b1fe17 | ||
|
|
8b03f60278 | ||
|
|
087a27aba9 | ||
|
|
adf475ef82 | ||
|
|
2eb7e3c80b | ||
|
|
f54a4e3de1 | ||
|
|
2bc7762cb6 | ||
|
|
9dc660269f | ||
|
|
1601387cbe | ||
|
|
45ef1f8eeb | ||
|
|
e4ddca0f8b | ||
|
|
19b8e3042e | ||
|
|
67c505781c | ||
|
|
ee50afef59 | ||
|
|
34f6088c8f | ||
|
|
431282e778 | ||
|
|
3155bc9936 | ||
|
|
1c52d15d97 | ||
|
|
f28bde7250 | ||
|
|
122c92e590 | ||
|
|
124c0940e9 | ||
|
|
29ef108158 | ||
|
|
a703e24573 | ||
|
|
387c8f852c | ||
|
|
091991be0d | ||
|
|
d505b94fa4 | ||
|
|
f2f3bdea8d | ||
|
|
583859b820 | ||
|
|
8e69c9f0a1 | ||
|
|
26ed7c2e1d | ||
|
|
77687de509 | ||
|
|
be805f942e | ||
|
|
c044a70796 | ||
|
|
cfd6e25749 | ||
|
|
3602690886 | ||
|
|
3d8823cafc | ||
|
|
f5ff05be1e | ||
|
|
6b58a359e8 | ||
|
|
96efb5ec96 | ||
|
|
e1e1855b85 | ||
|
|
3a6348dbb9 | ||
|
|
f7ecad843b | ||
|
|
4d498db3ed | ||
|
|
c41eb27091 | ||
|
|
2ac771b35e | ||
|
|
8339b60fd5 | ||
|
|
589f2f6d6e | ||
|
|
ce1ac88543 | ||
|
|
4594667f07 | ||
|
|
6ff6f756c0 | ||
|
|
46d646064c | ||
|
|
78d12bbbe9 | ||
|
|
6da438dabd | ||
|
|
4ec26da2f7 | ||
|
|
0e4efab270 | ||
|
|
ca2ebc5b68 | ||
|
|
5850b1f53b | ||
|
|
779c001e44 | ||
|
|
79f56e2e7e | ||
|
|
90dc467fc0 | ||
|
|
65cdccb70f | ||
|
|
1e79cf6a47 | ||
|
|
20ca9feeb3 | ||
|
|
b1f3a2dd66 | ||
|
|
e74791d054 | ||
|
|
8ed941fa69 | ||
|
|
a68d1b4517 | ||
|
|
c28da22e9c | ||
|
|
cd5eb62961 | ||
|
|
6e1db21733 | ||
|
|
a718a81d27 | ||
|
|
3635b1501d | ||
|
|
de76fbeefb | ||
|
|
e0d88c2814 | ||
|
|
671ba85d41 | ||
|
|
ac44b48297 | ||
|
|
64ba451049 | ||
|
|
6e5f7bb9d3 | ||
|
|
58e0a6f4a0 | ||
|
|
d6470870d0 | ||
|
|
fdf932c61c | ||
|
|
d28d45af91 | ||
|
|
d243668d16 | ||
|
|
466a70f7c1 | ||
|
|
082c8d0db8 | ||
|
|
0924069b68 | ||
|
|
4707d11004 | ||
|
|
9b41308b9f | ||
|
|
bff8b91638 | ||
|
|
1a44a99f17 | ||
|
|
d3566ee1b0 | ||
|
|
9e8702d3d5 | ||
|
|
27b6bfc213 | ||
|
|
dff383ce8f | ||
|
|
5e94c81e98 | ||
|
|
2416e2343a | ||
|
|
bf8f791a93 | ||
|
|
27c83f7177 | ||
|
|
359659cf4b | ||
|
|
9c6ae1dc0b | ||
|
|
0df32de02d | ||
|
|
a77054f90f | ||
|
|
1324ca1a0f | ||
|
|
209a871b63 | ||
|
|
07bbe214aa | ||
|
|
958845ae35 | ||
|
|
bc2560480e | ||
|
|
9354855648 | ||
|
|
226b5c7b0a | ||
|
|
ce7957c085 | ||
|
|
c6a1167e8b | ||
|
|
c809867035 | ||
|
|
2c76122a48 | ||
|
|
da122231e4 | ||
|
|
34ea836d77 | ||
|
|
59f5a1089a | ||
|
|
81d6b3e435 | ||
|
|
dfa41afd43 | ||
|
|
95161ed313 | ||
|
|
1fcda912db | ||
|
|
0713e09526 | ||
|
|
402f3b4993 | ||
|
|
b34a496649 | ||
|
|
8f17741849 | ||
|
|
d22b8d8e7e | ||
|
|
d33ce49aaa | ||
|
|
89cb408bb0 | ||
|
|
5f483369aa | ||
|
|
7e24176ca1 | ||
|
|
08d8876230 | ||
|
|
596ca83f0c | ||
|
|
b4a7906bca | ||
|
|
7a09e727e3 | ||
|
|
32e403a908 | ||
|
|
c879873b3e | ||
|
|
8bbc4fcb57 | ||
|
|
7f236fcc40 | ||
|
|
39b3a436d3 | ||
|
|
8f9ce13e43 | ||
|
|
f0b9b60f62 | ||
|
|
c2aeaa3959 | ||
|
|
024db279c4 | ||
|
|
e70179a620 | ||
|
|
c0322e490b | ||
|
|
1c20d01f10 | ||
|
|
391e064b8f | ||
|
|
1b2602344f | ||
|
|
337b338187 | ||
|
|
5aa1881959 | ||
|
|
8bb8a9a37c | ||
|
|
c7e087cf56 | ||
|
|
aa6650a2e7 | ||
|
|
2fc6e8a894 | ||
|
|
53d3cece00 | ||
|
|
df641e74ff | ||
|
|
35d083e166 | ||
|
|
47d0517d66 | ||
|
|
3eb69be879 | ||
|
|
cf01a743af | ||
|
|
9eab9f7415 | ||
|
|
fe693c4922 | ||
|
|
9575d6a6ce | ||
|
|
35f7bcdaa2 | ||
|
|
57b861148e | ||
|
|
eb2906a65c | ||
|
|
170d6269eb | ||
|
|
811ee4eb5d | ||
|
|
e66466a331 | ||
|
|
698b93b86d | ||
|
|
eef4e0836c | ||
|
|
4c94282fdf | ||
|
|
743f38209d | ||
|
|
44e426e4ff | ||
|
|
587a5153f0 | ||
|
|
be453ba3c3 | ||
|
|
17852784e8 | ||
|
|
c6fa5bb1cd | ||
|
|
49ecffb86e | ||
|
|
999ba49611 | ||
|
|
f0fb20cd83 | ||
|
|
e25fbc879e | ||
|
|
2a6303e018 | ||
|
|
d21916c0ff | ||
|
|
54fc8075e6 | ||
|
|
6dc13f2194 | ||
|
|
127ab0a9f6 | ||
|
|
a8a4c9828a | ||
|
|
f5a2138e8c | ||
|
|
cde5a4a5d5 | ||
|
|
55df62954b | ||
|
|
504b960fb4 | ||
|
|
d9ea1aaeb0 | ||
|
|
28d1ef5be9 | ||
|
|
36b6c37496 | ||
|
|
e48b4b492d | ||
|
|
52facc7984 | ||
|
|
7a51337ce0 | ||
|
|
291bc9ea07 | ||
|
|
39f0c66cbe | ||
|
|
3957b0befb | ||
|
|
538a41e70d | ||
|
|
d25280dc20 | ||
|
|
84f67379c8 | ||
|
|
de2cd2e9c8 | ||
|
|
1bf4af6395 | ||
|
|
b9bbfa659f | ||
|
|
fcb735fd99 | ||
|
|
c451dd2c77 | ||
|
|
6b21e5c8f0 | ||
|
|
493697a0aa | ||
|
|
c3444f8c7a | ||
|
|
2c262de0fe | ||
|
|
b80ed77cdd | ||
|
|
da3178f377 | ||
|
|
ec3a2e6f04 | ||
|
|
07d9b730b7 | ||
|
|
743ce8119b | ||
|
|
bff65f42ee | ||
|
|
e2c4da7dd2 | ||
|
|
3ee781b895 | ||
|
|
326f6adcfa | ||
|
|
046302c0cb | ||
|
|
2b8353d3b3 | ||
|
|
d977ee8a24 | ||
|
|
22433163b3 | ||
|
|
702283093a | ||
|
|
75cd0a9bd9 | ||
|
|
32f600b083 | ||
|
|
69996114d9 | ||
|
|
785e4ab360 | ||
|
|
a2413e010f | ||
|
|
5ab79e2514 | ||
|
|
3faff0b8ea | ||
|
|
6c72509f5b | ||
|
|
e71282394c | ||
|
|
ddd748e67a | ||
|
|
0d40d97d3e | ||
|
|
3346ad1134 | ||
|
|
c8916a08de | ||
|
|
f4d1bbb7c5 | ||
|
|
5eea4a3767 | ||
|
|
3b0fcb620d | ||
|
|
7815953cb4 | ||
|
|
54e96b40b7 | ||
|
|
02618c8df5 | ||
|
|
e3d0ac7c9d | ||
|
|
f97e78726e | ||
|
|
a7c218480d | ||
|
|
eebae9c63b | ||
|
|
c43ecd1c47 | ||
|
|
76c09e7076 | ||
|
|
53d3519a35 | ||
|
|
6366d3dd19 | ||
|
|
b26c85f081 | ||
|
|
343db40375 | ||
|
|
bbed65d100 | ||
|
|
24986f853c | ||
|
|
a7e7241616 | ||
|
|
739d153ef7 | ||
|
|
16459910a9 | ||
|
|
5e860c08d8 | ||
|
|
59c8d81381 | ||
|
|
c2a1f28a2e | ||
|
|
679ab5bc20 | ||
|
|
c15a8f8a3d | ||
|
|
5893cfcd90 | ||
|
|
c023f06aad | ||
|
|
569cd23c00 | ||
|
|
be2674bf3c | ||
|
|
626c48e947 | ||
|
|
07f9a7ea02 | ||
|
|
02a76b79a1 | ||
|
|
8f12f948b1 | ||
|
|
31762899a0 | ||
|
|
b8049ba201 | ||
|
|
54541a9927 | ||
|
|
142b26ea7b | ||
|
|
7fa9799e28 | ||
|
|
3e568eb3b0 | ||
|
|
459f8dfccb | ||
|
|
dae4026c18 | ||
|
|
36b0481f24 | ||
|
|
826425fdfd | ||
|
|
6c1ddeedfb | ||
|
|
082b877d81 | ||
|
|
35d20b2168 | ||
|
|
e56cc11757 | ||
|
|
229c4d8f7c | ||
|
|
b1d0f9743e | ||
|
|
b4354fc66f | ||
|
|
b5fd95cab9 | ||
|
|
df34ed7a00 | ||
|
|
b8ba5c2bcb | ||
|
|
b2c801f3c7 | ||
|
|
21010ee25a | ||
|
|
f409d65d15 | ||
|
|
af21ec6165 | ||
|
|
07ee20d07d | ||
|
|
4ca4865170 | ||
|
|
338c5f6a0b | ||
|
|
6f52970a6d | ||
|
|
fb2380c3cc | ||
|
|
96936b5616 | ||
|
|
8a23dd94cb | ||
|
|
6a877661fb | ||
|
|
b361a4c056 | ||
|
|
ae5ecdf2ae | ||
|
|
826667a54c | ||
|
|
6c839985b9 | ||
|
|
24819e8aae | ||
|
|
0303e9b137 | ||
|
|
b92f4ec6fb | ||
|
|
b8128d6b1e | ||
|
|
5f48e4a120 | ||
|
|
a3cd2f3929 | ||
|
|
b2db089eef | ||
|
|
c2e6fe4d5d | ||
|
|
fe4c4f1461 | ||
|
|
a3fb689942 | ||
|
|
90f7337858 | ||
|
|
98ac3df713 | ||
|
|
8fc6a65be8 | ||
|
|
8d693a2a27 | ||
|
|
daf56b3f62 | ||
|
|
724038e4b5 | ||
|
|
4f6dca42ea | ||
|
|
110048f983 | ||
|
|
4112b8f14b | ||
|
|
4d8cb3244e | ||
|
|
97cf16e958 | ||
|
|
6d7e8a97bb | ||
|
|
ee7fe02953 | ||
|
|
a59fac5e4b | ||
|
|
7b378cb742 | ||
|
|
d289eb22f1 | ||
|
|
c8226f69e1 | ||
|
|
03f444e601 | ||
|
|
d8557a2627 | ||
|
|
3c4b3747e4 | ||
|
|
9a14086e6d | ||
|
|
64f0b3c81e | ||
|
|
5f404a0592 | ||
|
|
930f03c864 | ||
|
|
9b20cadaeb | ||
|
|
4404e7e328 | ||
|
|
780ce3902e | ||
|
|
e909a92343 | ||
|
|
81e88b70bd | ||
|
|
d2f647cee4 | ||
|
|
3c88e520da | ||
|
|
0caa243212 | ||
|
|
4ecd74693f | ||
|
|
94badad24c | ||
|
|
1371e81944 | ||
|
|
969195ad55 | ||
|
|
a44910b837 | ||
|
|
2b9b4a35b2 | ||
|
|
3443c177a3 | ||
|
|
98b76f4b98 | ||
|
|
15ac4e5fb6 | ||
|
|
488b90f5ac | ||
|
|
c5b6a107eb | ||
|
|
f35838beb6 | ||
|
|
5ee8b348eb | ||
|
|
8a0bae45c2 | ||
|
|
b5b8198fd1 | ||
|
|
c6084704cc | ||
|
|
2b23d6a9f7 | ||
|
|
c042c08179 | ||
|
|
f74f5e3ebf | ||
|
|
f1893c8355 | ||
|
|
d9f34c6848 | ||
|
|
4f12bfa636 | ||
|
|
326a22e888 | ||
|
|
0163a836a1 | ||
|
|
7ba5a534ae | ||
|
|
07e0a6198d | ||
|
|
c2fab5b4ca | ||
|
|
27eb54a20a | ||
|
|
b1c8fd3b67 | ||
|
|
8b792be81b | ||
|
|
b6e16799d0 | ||
|
|
19756d57f7 | ||
|
|
1e3eb4ef9e | ||
|
|
42b8a6d8ab | ||
|
|
4c11fb7f04 | ||
|
|
06ecae43bd | ||
|
|
7773b2712e | ||
|
|
33735480f7 | ||
|
|
a5b3719967 | ||
|
|
d181577f3e | ||
|
|
2a6b835a5e | ||
|
|
3bd16ce9c5 | ||
|
|
4872f4628c | ||
|
|
f17ead4133 | ||
|
|
799bf116fe | ||
|
|
c3055863c6 | ||
|
|
57c71ec9b6 | ||
|
|
476ab203bc | ||
|
|
0465d34955 | ||
|
|
eb124353af | ||
|
|
49fb630eb4 | ||
|
|
a6a8342066 | ||
|
|
87abd9c609 | ||
|
|
5b4e9aff0e | ||
|
|
2f98ef1792 | ||
|
|
b4ca6c95b6 | ||
|
|
dddb41e349 | ||
|
|
ca187abd13 | ||
|
|
ac4e05874a | ||
|
|
098865122c | ||
|
|
1720e4bb87 | ||
|
|
0db1d3d675 | ||
|
|
94981e1701 | ||
|
|
48e2ecc14d | ||
|
|
4862d29a96 | ||
|
|
3ccdfce2e5 | ||
|
|
14f207f3fc | ||
|
|
df1c2335c8 | ||
|
|
b17cad65cf | ||
|
|
a855ba8189 | ||
|
|
632304209c | ||
|
|
e93b07eef6 | ||
|
|
73c3040896 | ||
|
|
0f40d8149a | ||
|
|
e1562afb58 | ||
|
|
a80bd7708d | ||
|
|
e40342afbe | ||
|
|
0b41cec7a4 | ||
|
|
e2a36dda0a | ||
|
|
14a1839a45 | ||
|
|
81f4412e0e | ||
|
|
a0e7706440 | ||
|
|
fad8d743b5 | ||
|
|
9e843468de | ||
|
|
99ebac7e84 | ||
|
|
4a6a0c3c65 | ||
|
|
e0ba49e780 | ||
|
|
11cd49987a | ||
|
|
aad828704d | ||
|
|
0eb6dc36f0 | ||
|
|
d88cd02fd8 | ||
|
|
b8f1263f16 | ||
|
|
d8d9591076 | ||
|
|
9379a14cb4 | ||
|
|
0bfbacd8b1 | ||
|
|
e6a32d6283 | ||
|
|
642bbf6060 | ||
|
|
537def4a4f | ||
|
|
1832e33753 | ||
|
|
39d12818fe | ||
|
|
1500632b60 | ||
|
|
d3f3b423ad | ||
|
|
16f9798208 | ||
|
|
cac2077c36 | ||
|
|
0b680379e5 | ||
|
|
456c42b00d | ||
|
|
9fc0701247 | ||
|
|
837ba94dde | ||
|
|
ea4570da57 | ||
|
|
ef5875cc19 | ||
|
|
6ac70450dc | ||
|
|
6140d08241 | ||
|
|
39841562c5 | ||
|
|
3235766d67 | ||
|
|
57c4684035 | ||
|
|
795f18560b | ||
|
|
aae7e39a56 | ||
|
|
ba3dab5047 | ||
|
|
f6107bc151 | ||
|
|
1cac72bfa9 | ||
|
|
2dae61c0e3 | ||
|
|
e851efb29b | ||
|
|
57c138e59b | ||
|
|
2c465de332 | ||
|
|
1d42d9d274 | ||
|
|
f3bc8b6e1f | ||
|
|
21c88c829a | ||
|
|
6c1be607f1 | ||
|
|
59b29d02f8 | ||
|
|
0d52ef7084 | ||
|
|
e8bdcdb0a7 | ||
|
|
8bfe0d873f | ||
|
|
5b30e960eb | ||
|
|
947248129b | ||
|
|
0a4e65c0ed | ||
|
|
fe945345dd | ||
|
|
dfd3e45ad0 | ||
|
|
4bceb312f1 | ||
|
|
b2cee7bee8 | ||
|
|
a030a58303 | ||
|
|
5c915451e7 | ||
|
|
8b88549bb7 | ||
|
|
3e66f08db7 | ||
|
|
6131390345 | ||
|
|
0eccd7a856 | ||
|
|
f0d3edf409 | ||
|
|
8aff6f5ed0 | ||
|
|
617bc8cc1c | ||
|
|
f9a48e0f0b | ||
|
|
9ec222c363 | ||
|
|
2c914126ba | ||
|
|
e2961b9f91 | ||
|
|
4f786e4f62 | ||
|
|
92d3616b02 | ||
|
|
fecb35a08e | ||
|
|
649dac1029 | ||
|
|
dc31c11339 | ||
|
|
e45d425343 | ||
|
|
847735553a | ||
|
|
b825bbd4a2 | ||
|
|
c26a6c310c | ||
|
|
8eb40c777e | ||
|
|
8b2255d0f8 | ||
|
|
5fcaf45c33 | ||
|
|
1adba3c9e9 | ||
|
|
30018e604c | ||
|
|
e40c1637c9 | ||
|
|
e3c771f36b | ||
|
|
2bbd7ba1c2 | ||
|
|
340b245903 | ||
|
|
e5b9ae1f8e | ||
|
|
3a9d9f2279 | ||
|
|
3369d87da9 | ||
|
|
470af31f4a | ||
|
|
3327652623 | ||
|
|
8a4c83022a | ||
|
|
af921c7f51 | ||
|
|
248c9ec53f | ||
|
|
4972133a9b | ||
|
|
8c8938e8cb | ||
|
|
cfbbd15de7 | ||
|
|
0c88ae42e6 | ||
|
|
4b69798796 | ||
|
|
947375e982 | ||
|
|
afaed3343a | ||
|
|
42bffb575d | ||
|
|
bcb10af64f | ||
|
|
b149be5d86 | ||
|
|
abf96670ce | ||
|
|
86bdd85c4a | ||
|
|
512beb8795 | ||
|
|
a123f8351d | ||
|
|
7ccbcd28f0 | ||
|
|
598f977df4 | ||
|
|
c477242376 | ||
|
|
3ef4115349 | ||
|
|
1511dfa637 | ||
|
|
495f87363b | ||
|
|
1ba83c47ce | ||
|
|
edf7e5f420 | ||
|
|
9ffcbb82a2 | ||
|
|
c86de38780 | ||
|
|
20f8027641 | ||
|
|
0228851f19 | ||
|
|
a8300c0ae6 | ||
|
|
a9ec28a1b4 | ||
|
|
2e196be143 | ||
|
|
ebdd5cabab | ||
|
|
a9839dc7db | ||
|
|
2c1f51be0e | ||
|
|
129ee3510f | ||
|
|
55ad38964b | ||
|
|
2d5542502b | ||
|
|
c4a7760ca6 | ||
|
|
a501b0ca81 | ||
|
|
3488f3ade7 | ||
|
|
aa60b8ea5b | ||
|
|
6931bd6715 | ||
|
|
25f86f1347 | ||
|
|
1f83ccb308 | ||
|
|
592fb34a3d | ||
|
|
cb0d4efba2 | ||
|
|
3d8d465a90 | ||
|
|
ded42e6498 | ||
|
|
e8683f00a6 | ||
|
|
7b5c11f66b | ||
|
|
afa7594a20 | ||
|
|
6e52b5fe41 | ||
|
|
52fe3f790e | ||
|
|
dd777b3d7e | ||
|
|
df272b7740 | ||
|
|
db108a19c8 | ||
|
|
c244f8ea87 | ||
|
|
f045979f8d | ||
|
|
3d59569264 | ||
|
|
5469291296 | ||
|
|
3b35f1c37d | ||
|
|
e813574497 | ||
|
|
e1e6255b48 | ||
|
|
1a9f0be6df | ||
|
|
d9ec7000db | ||
|
|
6b975cbd82 | ||
|
|
76be17b00a | ||
|
|
0cd6959f19 | ||
|
|
741fd3ded5 | ||
|
|
ff2b496e2d | ||
|
|
6a24eb6d20 | ||
|
|
b5d2160ef8 | ||
|
|
333ac101ba | ||
|
|
8a42d5fb41 | ||
|
|
e91ee0e246 | ||
|
|
ab8e43a196 | ||
|
|
c05b1bfca9 | ||
|
|
011f6dac82 | ||
|
|
f35363e584 | ||
|
|
c8d3dcb315 | ||
|
|
2ec1bdd0ab | ||
|
|
3d0a1eb90d | ||
|
|
65ec319f01 | ||
|
|
17dd3c0a76 | ||
|
|
9606f0240b | ||
|
|
31c0962e83 | ||
|
|
3f84190a7b | ||
|
|
bea2060182 | ||
|
|
6632fb87c0 | ||
|
|
df7aece2c8 | ||
|
|
097121d214 | ||
|
|
21c9680a11 | ||
|
|
8d63577b78 | ||
|
|
2c2af651c4 | ||
|
|
13a6e02ccd | ||
|
|
025543b604 | ||
|
|
f32b86dba2 | ||
|
|
0bb8be0e5b | ||
|
|
a4605fe324 | ||
|
|
f12584b94a | ||
|
|
43477edc91 | ||
|
|
318ca102cd | ||
|
|
14c12fb151 | ||
|
|
3246fc088a | ||
|
|
45873e2a0a | ||
|
|
5bf396d5d1 | ||
|
|
66339b21fa | ||
|
|
d8180f5dac | ||
|
|
48f59aa1f7 | ||
|
|
56c82c52b0 | ||
|
|
36485983ca | ||
|
|
6087015f1c | ||
|
|
5c92c72e2c | ||
|
|
4656c9b89b | ||
|
|
8370e66464 | ||
|
|
f9b7d92b91 | ||
|
|
c8a68334a7 | ||
|
|
953b234aff | ||
|
|
c9bee155c2 | ||
|
|
4291f76c99 | ||
|
|
82e6706722 | ||
|
|
af4fb8cedc | ||
|
|
c8fc19a779 | ||
|
|
012f0334ce | ||
|
|
0051837af4 | ||
|
|
8b7fcfb49a | ||
|
|
d22eaf96e2 | ||
|
|
373166d833 | ||
|
|
39fe0068aa | ||
|
|
1d1831ba40 | ||
|
|
3501ea4634 | ||
|
|
9968a10fcf | ||
|
|
768b175fee | ||
|
|
a17f5592f8 | ||
|
|
fbb8d32c4e | ||
|
|
4401620111 | ||
|
|
b8a8835151 | ||
|
|
4f463e897a | ||
|
|
58eacfa1ad | ||
|
|
c93419f512 | ||
|
|
53ba629a23 | ||
|
|
62925fb668 | ||
|
|
94da24e387 | ||
|
|
2d283c9f2d | ||
|
|
54ad646067 | ||
|
|
12760f2295 | ||
|
|
c64c0ab121 | ||
|
|
2f39e0e2aa | ||
|
|
23ced527f7 | ||
|
|
2affd6385e | ||
|
|
58376489af | ||
|
|
a2dbf54456 | ||
|
|
03d844f926 | ||
|
|
9ffc5e6a95 | ||
|
|
22e31b4b73 | ||
|
|
c0e9f411fc | ||
|
|
61421843bc | ||
|
|
ce6762ff63 | ||
|
|
d8f2463b57 | ||
|
|
f0c592b09e | ||
|
|
a4cd1a85d6 | ||
|
|
3440fca2e8 | ||
|
|
10b6d77945 | ||
|
|
917a15f154 | ||
|
|
0a52d9405e | ||
|
|
cde6fdd00f | ||
|
|
a829ef9b46 | ||
|
|
056da86f6d | ||
|
|
c1eb7027fc | ||
|
|
2cb523b267 | ||
|
|
6d0315f78f | ||
|
|
b891877ee6 | ||
|
|
9d0d11a369 | ||
|
|
6c73d864ef | ||
|
|
b9b5be7c4c | ||
|
|
d991fb032a | ||
|
|
9f42a50742 | ||
|
|
88011f4032 | ||
|
|
1aa7658256 | ||
|
|
e77344345a | ||
|
|
a0ffeaa56e | ||
|
|
efbae1855b | ||
|
|
f040b2aa5d | ||
|
|
09c52e7282 | ||
|
|
4b6649e37b | ||
|
|
aeeb0af3a2 | ||
|
|
148c1b5c13 | ||
|
|
377ac9501a | ||
|
|
78e5262dbd | ||
|
|
0f40290039 | ||
|
|
4ffc3e4d1f | ||
|
|
f44b86e039 | ||
|
|
3bc01eed6f | ||
|
|
3dc61e5d68 | ||
|
|
98680b64f4 | ||
|
|
d8268fb7b4 | ||
|
|
2e5a674601 | ||
|
|
61617e74ed | ||
|
|
b676bf3214 | ||
|
|
9dd823c289 | ||
|
|
d3b786399e | ||
|
|
a5e5a51fb4 | ||
|
|
09d97c1126 | ||
|
|
6a3ca7372f | ||
|
|
c951f0543c | ||
|
|
134699faf9 | ||
|
|
d06dabab59 | ||
|
|
a05aba1033 | ||
|
|
5a26241287 | ||
|
|
abfb38bd57 | ||
|
|
bd1f1404a0 | ||
|
|
f865d61713 | ||
|
|
1a6637c285 | ||
|
|
22701d149a | ||
|
|
d5fd3d3331 | ||
|
|
d5a8816926 | ||
|
|
6b13ecdc85 | ||
|
|
7eb9a9298e | ||
|
|
3e6e68baa1 | ||
|
|
0ab7a52f7c | ||
|
|
852de116dd | ||
|
|
0eccb547a2 | ||
|
|
d4385f6fc8 | ||
|
|
ee90f0af60 | ||
|
|
9edba838b3 | ||
|
|
b5c136152f | ||
|
|
6ef3710970 | ||
|
|
f75ee9fb6e | ||
|
|
8d9d9fb064 | ||
|
|
7de6b1e162 | ||
|
|
ec2859c0de | ||
|
|
f5775594cc | ||
|
|
37786613e0 | ||
|
|
ea2b639d31 | ||
|
|
79f3e69f5e | ||
|
|
840540b6b1 | ||
|
|
9473f15909 | ||
|
|
286ddb672d | ||
|
|
972089826e | ||
|
|
c25a72ea24 | ||
|
|
73635df1b2 | ||
|
|
77bd9c4a9d | ||
|
|
f401287afb | ||
|
|
3becc47366 | ||
|
|
7d3d074e66 | ||
|
|
f40a1d6a8a | ||
|
|
82c9aa912e | ||
|
|
56b5f02551 | ||
|
|
c4f16c351c | ||
|
|
012cc33d44 | ||
|
|
415fb53cb4 | ||
|
|
b65b8c5ed3 | ||
|
|
c0cb698191 | ||
|
|
d2176cf052 | ||
|
|
f71bff1226 | ||
|
|
47f5a0db64 | ||
|
|
9e771aa79c | ||
|
|
29db7b7216 | ||
|
|
66de6b528d | ||
|
|
4f64938ff0 | ||
|
|
e5597dfcce | ||
|
|
787c1e8c6e | ||
|
|
ec6584f2d1 | ||
|
|
62f0df4434 | ||
|
|
5cdcf58b3b | ||
|
|
b84547d786 | ||
|
|
d83919a6f7 | ||
|
|
2ef782b8e6 | ||
|
|
b738c97ec3 | ||
|
|
022c370bcd | ||
|
|
587385bfe0 | ||
|
|
ca033b83fe | ||
|
|
949a29c34f | ||
|
|
be884341f4 | ||
|
|
c88fd8cc9d | ||
|
|
8385fb397b | ||
|
|
e0df4b5f18 | ||
|
|
39ad5e7388 | ||
|
|
0df505bd7c | ||
|
|
6f6a920a68 | ||
|
|
32293655ff | ||
|
|
07ad75ee04 | ||
|
|
e4b41320e6 | ||
|
|
9f119ee420 | ||
|
|
e0df2168b7 | ||
|
|
d7e8073198 | ||
|
|
65a0fd88a9 | ||
|
|
4b7cf389e4 | ||
|
|
86d466c745 | ||
|
|
de9d84489b | ||
|
|
18a736fbe6 | ||
|
|
7bdf37bc27 | ||
|
|
41517e2111 | ||
|
|
555472bf1e | ||
|
|
7da16c584a | ||
|
|
a8cf5b8502 | ||
|
|
cdab4fabf4 | ||
|
|
d9c49ad30d | ||
|
|
188e7609b3 | ||
|
|
2b62980e26 | ||
|
|
805abee9b4 | ||
|
|
a1bb7fb0d2 | ||
|
|
9083735963 | ||
|
|
dcf20c4cfe | ||
|
|
d57a5efab3 | ||
|
|
3781c96125 | ||
|
|
1faa76a86f | ||
|
|
ecf57cac5c | ||
|
|
25db83fe85 | ||
|
|
ba0db9db86 | ||
|
|
a6415cf895 | ||
|
|
df935f5b03 | ||
|
|
43a64d9515 | ||
|
|
70a6d035d9 | ||
|
|
716b627c1e | ||
|
|
798a1ffdec | ||
|
|
8028103b71 | ||
|
|
8430e6ccbb | ||
|
|
d4c461042b | ||
|
|
60b1a0ba13 | ||
|
|
cfd84d74ee | ||
|
|
eec9bdd434 | ||
|
|
f74d5e96dd | ||
|
|
e63e68ef48 | ||
|
|
73425fbffb | ||
|
|
f53aed1611 | ||
|
|
2ed976ea71 | ||
|
|
767f758aac | ||
|
|
961790f95c | ||
|
|
f705c41c1d | ||
|
|
93be6916f9 | ||
|
|
340931ba8e | ||
|
|
2c5ea69e5d | ||
|
|
d59510481a | ||
|
|
f3036adc4f | ||
|
|
489a412f96 | ||
|
|
72e155e529 | ||
|
|
e715d7184b | ||
|
|
3bb13f8fbb | ||
|
|
01993d21dc | ||
|
|
5e94f38001 | ||
|
|
3004ad5398 | ||
|
|
e7c9bbb96f | ||
|
|
00ab8fbfea | ||
|
|
9930c9c737 | ||
|
|
2ee814d924 | ||
|
|
8b55a253b1 | ||
|
|
786fe94ac4 | ||
|
|
fede8e5af3 | ||
|
|
2a34335dc3 | ||
|
|
3b0d8b8e39 | ||
|
|
715a57dec8 | ||
|
|
2aabb71dc8 | ||
|
|
003c795afe | ||
|
|
1621015e00 | ||
|
|
98114245c6 | ||
|
|
8eb4243f12 | ||
|
|
569b59f495 | ||
|
|
8f42369aa9 | ||
|
|
f4e7809e7c | ||
|
|
2afe3b2e99 | ||
|
|
9ce7f0bf5b | ||
|
|
7430a49f45 | ||
|
|
538dbaecbe | ||
|
|
5943afa25d | ||
|
|
6e76ab7188 | ||
|
|
2b6ebd2521 | ||
|
|
eacb91afb1 | ||
|
|
4c8af1fff4 | ||
|
|
c03e14242b | ||
|
|
9cb3d6444d | ||
|
|
053613688b | ||
|
|
2eb682671d | ||
|
|
e7786ec14f | ||
|
|
88fda94218 | ||
|
|
b599886beb | ||
|
|
7aedc6bb22 | ||
|
|
efefc6b778 | ||
|
|
50e592209f | ||
|
|
18857a0eed | ||
|
|
8781b56a0e | ||
|
|
e585e496c9 | ||
|
|
f93275c47f | ||
|
|
4f83ef8328 | ||
|
|
0f1bb96f01 | ||
|
|
e6e9b550c0 | ||
|
|
f8f1db8458 | ||
|
|
7e825acd9b | ||
|
|
f7596c75dc | ||
|
|
505d2487e3 | ||
|
|
ab36f3cc6f | ||
|
|
49ca72c802 | ||
|
|
d2ba5798ec | ||
|
|
c3bef6b0d9 | ||
|
|
98dea03710 | ||
|
|
0c609b59ab | ||
|
|
a7fef58756 | ||
|
|
3ff8d43801 | ||
|
|
9763a671da | ||
|
|
1866f7596e | ||
|
|
8f3f4e2744 | ||
|
|
4438bfcc44 | ||
|
|
65b6ef6036 | ||
|
|
1ca423ec80 | ||
|
|
770c3d7548 | ||
|
|
736e8cd735 | ||
|
|
6046fcffe8 | ||
|
|
d13bf9f113 | ||
|
|
ae5419db17 | ||
|
|
9c2f9f61ef | ||
|
|
636476e704 | ||
|
|
aafca7acdc | ||
|
|
a527ecfabd | ||
|
|
967cfbe663 | ||
|
|
9df450193f | ||
|
|
082029ff2e | ||
|
|
c0baec1431 | ||
|
|
561366cab0 | ||
|
|
f0950a9e6c | ||
|
|
c5d0a0931e | ||
|
|
36dcce1a06 | ||
|
|
ed0242ae3a | ||
|
|
eda4b55f7a | ||
|
|
6e3cfe5dd5 | ||
|
|
fb49481ddf | ||
|
|
17ecb6891c | ||
|
|
4c3432b759 | ||
|
|
59f916ca4a | ||
|
|
6d6252aa9f | ||
|
|
2426eeb371 | ||
|
|
e5f1053b30 | ||
|
|
c73f653352 | ||
|
|
5b937b384b | ||
|
|
8ebeb3dc3f | ||
|
|
dfa59c2d97 | ||
|
|
511cc4c034 | ||
|
|
fa9234da05 | ||
|
|
afcc883d7f | ||
|
|
1e465fd255 | ||
|
|
49a3664222 | ||
|
|
848f2c297e | ||
|
|
5c47ce1136 | ||
|
|
88f13598f3 | ||
|
|
d22ac00098 | ||
|
|
dccfc5ba3c | ||
|
|
e7247ce3f6 | ||
|
|
168c3e6913 | ||
|
|
82d36d8259 | ||
|
|
b9e5cce2d2 | ||
|
|
1abd13700b | ||
|
|
54ed5ed469 | ||
|
|
cdb700737b | ||
|
|
ca0aea640d | ||
|
|
20a8a9b681 | ||
|
|
9c18febf45 | ||
|
|
848aca21be | ||
|
|
f37b968475 | ||
|
|
f0660e33a2 | ||
|
|
333fa87489 | ||
|
|
037b38badb | ||
|
|
39acf1dbd2 | ||
|
|
59b69d1fb8 | ||
|
|
d06908d655 | ||
|
|
5b5ffc9714 | ||
|
|
75703d57e6 | ||
|
|
bd6b981d12 | ||
|
|
6a2eea8b21 | ||
|
|
325ea7b7e2 | ||
|
|
4ffae38627 | ||
|
|
d7908a9fde | ||
|
|
0cd23d8d6e | ||
|
|
aca91e06f2 | ||
|
|
88177ec33f | ||
|
|
1d5c4f3f0f | ||
|
|
478d49027f | ||
|
|
46a770e03f | ||
|
|
ba25184ed5 | ||
|
|
7f1ad5c127 | ||
|
|
ab19b79375 | ||
|
|
c63472e328 | ||
|
|
6963b8490c | ||
|
|
9d16c72767 | ||
|
|
186a589783 | ||
|
|
12ef43e407 | ||
|
|
92f7478174 | ||
|
|
19d38d502f | ||
|
|
52d328ec3c | ||
|
|
a554828931 | ||
|
|
80a861cb84 | ||
|
|
0d07d1afb3 | ||
|
|
030b9763b5 | ||
|
|
03a3ca5004 | ||
|
|
1325409560 | ||
|
|
13aeb9cb06 | ||
|
|
7d217bf9bd | ||
|
|
cb2116dcce | ||
|
|
db90d85a8d | ||
|
|
af791d48c6 | ||
|
|
120a2f385a | ||
|
|
5bb2be9a23 | ||
|
|
e958511df0 | ||
|
|
1642996798 | ||
|
|
c41932e184 | ||
|
|
25ea8cdb38 | ||
|
|
e706d18cf8 | ||
|
|
e752455b6f | ||
|
|
3e72f234d0 | ||
|
|
25dc07e8ed | ||
|
|
13de69299f | ||
|
|
90e109c241 | ||
|
|
d25ba77b2e | ||
|
|
c0d4b23cea | ||
|
|
99eead01a3 | ||
|
|
d60845303b | ||
|
|
b14584f36e | ||
|
|
23d8522285 | ||
|
|
c4f9340fb4 | ||
|
|
d372a5b10b | ||
|
|
7aad3fd08c | ||
|
|
76c4b68e4a | ||
|
|
07441c8951 | ||
|
|
98ff29f793 | ||
|
|
08cab48431 | ||
|
|
7e7c275504 | ||
|
|
73abf84ace | ||
|
|
7eba5ffe48 | ||
|
|
1d2ee524d8 | ||
|
|
38f2581d6f | ||
|
|
b80f8aa475 | ||
|
|
057f32924a | ||
|
|
6a0845c984 | ||
|
|
18b29ea005 | ||
|
|
796d3225dd | ||
|
|
be62645dd5 | ||
|
|
603fd42fe6 | ||
|
|
1fc567449c | ||
|
|
c01bc5be5b | ||
|
|
577dba2bf7 | ||
|
|
a788cb7271 | ||
|
|
178ff62b93 | ||
|
|
aa99525537 | ||
|
|
7e0b9cf409 | ||
|
|
017c027629 | ||
|
|
c2480f65e6 | ||
|
|
3f86e22a07 | ||
|
|
b53975327f | ||
|
|
d0390d4f27 | ||
|
|
f3393fb24c | ||
|
|
4c21106222 | ||
|
|
87d9d9643c | ||
|
|
df5dcb8a7d | ||
|
|
69ba64380b | ||
|
|
d0285fac42 | ||
|
|
f73bda06e9 | ||
|
|
4dfd6f3fc1 | ||
|
|
cdec20af65 | ||
|
|
09a7251245 | ||
|
|
56f4b7ca68 | ||
|
|
4c8d1b9a7d | ||
|
|
6da7e22a4a | ||
|
|
5d9fcc711b | ||
|
|
2e31696156 | ||
|
|
0fb13e0b6c | ||
|
|
1da1490bcd | ||
|
|
9cdc8325ae | ||
|
|
12d66cfc41 | ||
|
|
9c8660dbb6 | ||
|
|
e7bc9bf1b2 | ||
|
|
e2ad0d0fe8 | ||
|
|
3299771e34 | ||
|
|
f2be5fae27 | ||
|
|
90cd37fda0 | ||
|
|
b0657cf163 | ||
|
|
03f6908fe9 | ||
|
|
c68f928254 | ||
|
|
ff954e16f1 | ||
|
|
d437c338d0 | ||
|
|
9fc7059140 | ||
|
|
544d08d0f6 | ||
|
|
ae55676a50 | ||
|
|
b07c1ebd85 | ||
|
|
113b67c069 | ||
|
|
12246afab8 | ||
|
|
85da715f40 | ||
|
|
b554b0c1cb | ||
|
|
9ff8cbe5fb | ||
|
|
79727abb32 | ||
|
|
ba485913b6 | ||
|
|
a95bfd3032 | ||
|
|
207a2744aa | ||
|
|
95084c9ca8 | ||
|
|
2f7923bc05 | ||
|
|
2ac3913733 | ||
|
|
231e343a3b | ||
|
|
c8ad4f0b73 | ||
|
|
25545b393b | ||
|
|
dfa89e299a | ||
|
|
318300848f | ||
|
|
d4aaef1e9a | ||
|
|
40a060cf57 | ||
|
|
ac5e6807fa | ||
|
|
250896b7f3 | ||
|
|
9d1d927420 | ||
|
|
440aeca5d4 | ||
|
|
b6af86225d | ||
|
|
c50f8f7cc8 | ||
|
|
8d8865aadb | ||
|
|
f7c10ca74d | ||
|
|
4cac9f07c4 | ||
|
|
f453892960 | ||
|
|
44b1e7ebea | ||
|
|
4ce6440795 | ||
|
|
22623bd8c2 | ||
|
|
5861254d8f | ||
|
|
ab2e7df8a9 | ||
|
|
beec48c8f8 | ||
|
|
b2427223c1 | ||
|
|
ef52044c5f | ||
|
|
ccea28db07 | ||
|
|
e21ef547f7 | ||
|
|
0af8ff9405 | ||
|
|
6e0ca583fe | ||
|
|
2bcc4a774a | ||
|
|
34268b16c3 | ||
|
|
1cfe59299b | ||
|
|
e771aa9386 | ||
|
|
cc7bee19f0 | ||
|
|
088f908d58 | ||
|
|
c4ad8afba9 | ||
|
|
0c09d16b29 | ||
|
|
30573b2d8b | ||
|
|
1a87f15e6f | ||
|
|
472a5b4748 | ||
|
|
b94510fc42 | ||
|
|
6e53290acd | ||
|
|
ca85b4ec6c | ||
|
|
a6360ca134 | ||
|
|
47aa968f3c | ||
|
|
3bf46609c8 | ||
|
|
cd0cbada65 | ||
|
|
ed559bb8b1 | ||
|
|
27e814ad76 | ||
|
|
03893d9b7f | ||
|
|
297aa04bea | ||
|
|
c678a7b402 | ||
|
|
b7242a1ad1 | ||
|
|
cf0a5089f5 | ||
|
|
de32f1774f | ||
|
|
e1c4fe21d4 | ||
|
|
89c8cbbe0c | ||
|
|
16ba63ccde | ||
|
|
347a52aa5c | ||
|
|
c920ee57b8 | ||
|
|
985a906c6c | ||
|
|
f038f68ad8 | ||
|
|
d3e6597f73 | ||
|
|
f8d729a17b | ||
|
|
b66427eab9 | ||
|
|
35d4a47cb1 | ||
|
|
a721d590b4 | ||
|
|
628e393b9a | ||
|
|
a950322b07 | ||
|
|
34917618d8 | ||
|
|
1a7c91f658 | ||
|
|
41687c8fa8 | ||
|
|
91f6e69cc4 | ||
|
|
6ec1a9ca52 | ||
|
|
9d33629b6d | ||
|
|
ef8563ab36 | ||
|
|
a392a87389 | ||
|
|
4a5b5bc86e | ||
|
|
68edcd12b1 | ||
|
|
fbc366c1a5 | ||
|
|
20b10aed1b | ||
|
|
b4505284f2 | ||
|
|
47fe258b5a | ||
|
|
21616a815b | ||
|
|
50934e056e | ||
|
|
ba1df2cfca | ||
|
|
7dc13e5cab | ||
|
|
7687746c7c | ||
|
|
5264c71d86 | ||
|
|
5d87e1aeba | ||
|
|
c03e893416 | ||
|
|
fef09a6691 | ||
|
|
1d35d439cc | ||
|
|
054e1ab3ee | ||
|
|
641f4611b2 | ||
|
|
594716abea | ||
|
|
d675abbd3f | ||
|
|
702f4039bc | ||
|
|
b479a62ec2 | ||
|
|
81c18c70f5 | ||
|
|
bbea679ab2 | ||
|
|
f1d51aa7eb | ||
|
|
5b5ff69201 | ||
|
|
0665129008 | ||
|
|
afd6482219 | ||
|
|
a23f22e5dc | ||
|
|
e00e50d01a | ||
|
|
1960c3c29d | ||
|
|
08f66a99b1 | ||
|
|
ab64052642 | ||
|
|
25a9c9fb22 | ||
|
|
f0beed8686 | ||
|
|
5a7d461230 | ||
|
|
d45eb53bc7 | ||
|
|
911e8aec8d | ||
|
|
9f89ebe0de | ||
|
|
526a0befc7 | ||
|
|
f0fe551dc9 | ||
|
|
f8e2d0e732 | ||
|
|
fcccc82282 | ||
|
|
3ddcc99131 | ||
|
|
70faca2a14 | ||
|
|
5f9fecd3aa | ||
|
|
6e780fad6d | ||
|
|
28b706da83 | ||
|
|
aa3347b2a3 | ||
|
|
f8a59c3e6f | ||
|
|
484916066a | ||
|
|
b3fbc810d2 | ||
|
|
1539d17366 | ||
|
|
a158abfa15 | ||
|
|
7d085b188c | ||
|
|
aaa3bf16a9 | ||
|
|
22a1f0917b | ||
|
|
78f48aef8f | ||
|
|
7b1b9df423 | ||
|
|
e23343ab17 | ||
|
|
b8affd9520 | ||
|
|
1790b1df17 | ||
|
|
60b4843678 | ||
|
|
0b42772663 | ||
|
|
a49db50b4a | ||
|
|
bfef8d99c8 | ||
|
|
dd271782e8 | ||
|
|
09da1921ff | ||
|
|
0769ee3b6d | ||
|
|
05de270d7a | ||
|
|
f1ba27faa2 | ||
|
|
8cb904b49d | ||
|
|
7e594eb121 | ||
|
|
4966d9c714 | ||
|
|
14da5cf180 | ||
|
|
6acce57271 | ||
|
|
c60b72e2d0 | ||
|
|
b2d03ac9a2 | ||
|
|
027fbd3d51 | ||
|
|
a2f773a9fc | ||
|
|
68d394952a | ||
|
|
e355d6ac6c | ||
|
|
dc74223461 | ||
|
|
5c4aa0bcb7 | ||
|
|
8c01865d62 | ||
|
|
916e6fcd64 | ||
|
|
4701243199 | ||
|
|
a7c5d5e8ac | ||
|
|
d0f23820b5 | ||
|
|
fe0b0a989f | ||
|
|
f549efd43d | ||
|
|
5eb3a17b55 | ||
|
|
b30b09e84c | ||
|
|
5152c98223 | ||
|
|
27c6dc3735 | ||
|
|
8b1b706903 | ||
|
|
64eee1eba7 | ||
|
|
1e64fbcb55 | ||
|
|
910b2312d6 | ||
|
|
54b77afbb5 | ||
|
|
be364e13d3 | ||
|
|
9bb332fee1 | ||
|
|
31c73a61f9 | ||
|
|
0d8d99de66 | ||
|
|
88b5ebceb6 | ||
|
|
4c647cd8b7 | ||
|
|
b95ad3f6a8 | ||
|
|
957216d1fb | ||
|
|
92209d9ebe | ||
|
|
c2100c0a4e | ||
|
|
c65a52a1d0 | ||
|
|
1451ba0c6d | ||
|
|
480a3821ab | ||
|
|
0569fe44d8 | ||
|
|
73ed0d01f6 | ||
|
|
82cce02120 | ||
|
|
e4c4c80b82 | ||
|
|
a982b0d903 | ||
|
|
c3431bb6f2 | ||
|
|
d11522b29e | ||
|
|
bc34f33955 | ||
|
|
4c3b9df609 | ||
|
|
5b5d8a81b7 | ||
|
|
bc4af7c7e1 | ||
|
|
ca0d08eeda | ||
|
|
a197309e21 | ||
|
|
a75ba04eed | ||
|
|
899c9a9522 | ||
|
|
42b0295521 | ||
|
|
4bad1285b6 | ||
|
|
a776e7cb3e | ||
|
|
def20cdb0c | ||
|
|
92355ada54 | ||
|
|
42ee255c80 | ||
|
|
4837900832 | ||
|
|
1c30ef453b | ||
|
|
377078b0f5 | ||
|
|
2c5b0207f5 | ||
|
|
e7598e006c | ||
|
|
03c8e23dbb | ||
|
|
ee6c638e9c | ||
|
|
2b4ca0b0dc | ||
|
|
98a7585fbd | ||
|
|
4e5c4a6ab7 | ||
|
|
8cf6a3593d | ||
|
|
e4b56049ad | ||
|
|
e766f0b67c | ||
|
|
f44bb31bec | ||
|
|
b1bcaecc66 | ||
|
|
94e82e9cc2 | ||
|
|
cc4b0b110f | ||
|
|
2b5aed78d0 | ||
|
|
7fc9378895 | ||
|
|
d5572ac13f | ||
|
|
0d183c41a9 | ||
|
|
0bee888f73 | ||
|
|
4a01272fb3 | ||
|
|
42a206e5d3 | ||
|
|
d15365bf4f | ||
|
|
898079f7e2 | ||
|
|
9ab3234f0e | ||
|
|
bf05b7aeb5 | ||
|
|
7ec0170a00 | ||
|
|
8b141b326a | ||
|
|
418a209330 | ||
|
|
73ca21ed8c | ||
|
|
fee7a7a80d | ||
|
|
ed360dcaf5 | ||
|
|
7ef6b6b682 | ||
|
|
b45a1081d2 | ||
|
|
12aa401885 | ||
|
|
92d57036f3 | ||
|
|
58c10edb07 | ||
|
|
c6183d273c | ||
|
|
3aefb8edc1 | ||
|
|
5ce4b69c9f | ||
|
|
88d4143018 | ||
|
|
ab27027aa8 | ||
|
|
2161d8f78d | ||
|
|
31d10c0b2b | ||
|
|
366e8e8498 | ||
|
|
19e1f2037c | ||
|
|
edfd0990b5 | ||
|
|
ec5844a3bc | ||
|
|
4d07cad175 | ||
|
|
4a9f3572a3 | ||
|
|
2acce4221e | ||
|
|
79992579c9 | ||
|
|
67c7e496f5 | ||
|
|
966672dbc1 | ||
|
|
fa838c7a85 | ||
|
|
342facb571 | ||
|
|
ddf2dde663 | ||
|
|
a98ec717f2 | ||
|
|
17aee31940 | ||
|
|
7e47d5ef30 | ||
|
|
584cfb664d | ||
|
|
f69934fb24 | ||
|
|
d74bd7e1a2 | ||
|
|
500dc78867 | ||
|
|
a7344a034a | ||
|
|
710f09f806 | ||
|
|
25b9b2330e | ||
|
|
93b2be48f0 | ||
|
|
f2820ee8c4 | ||
|
|
1a08cea007 | ||
|
|
ce595d4da7 | ||
|
|
ed642cfb6d | ||
|
|
3b5d580409 | ||
|
|
ad311497fa | ||
|
|
33eb76f958 | ||
|
|
5eb78876e1 | ||
|
|
e8d20926d3 | ||
|
|
23e6f533b0 | ||
|
|
b60b11e206 | ||
|
|
2eb63be19a | ||
|
|
8798dd5eda | ||
|
|
426734da51 | ||
|
|
ae41c733ea | ||
|
|
a5cb6355ed | ||
|
|
6ead850065 | ||
|
|
1960dabafd | ||
|
|
8f86ff633a | ||
|
|
4d5c327f6f | ||
|
|
b69854e96e | ||
|
|
fd6b1f0c4e | ||
|
|
ccd14ddc81 | ||
|
|
0af19a05ce | ||
|
|
f553857beb | ||
|
|
1607a6a3e2 | ||
|
|
95a03532c3 | ||
|
|
400046f911 | ||
|
|
71898bb793 | ||
|
|
ad18d9ddd6 | ||
|
|
4d06e4019f | ||
|
|
5c1bc201c4 | ||
|
|
cc723a64b9 | ||
|
|
f02573f743 | ||
|
|
7fea9afecd | ||
|
|
a1b6ef3f85 | ||
|
|
2dccc8e982 | ||
|
|
24ed8c9457 | ||
|
|
0d59a27b56 | ||
|
|
d36ceb9d06 | ||
|
|
27faf7aa69 | ||
|
|
5ee00a75e0 | ||
|
|
b93fbd30c3 | ||
|
|
61f16d1ddc | ||
|
|
f003025a37 | ||
|
|
31f74bd02e | ||
|
|
d5f9a2a51c | ||
|
|
8269ee7266 | ||
|
|
991f47ac08 | ||
|
|
1d1eb994dc | ||
|
|
68224252e2 | ||
|
|
36c32aead2 | ||
|
|
18be26fc2a | ||
|
|
59dea188da | ||
|
|
284deaa609 | ||
|
|
68f7fae7c3 | ||
|
|
20cd46426f | ||
|
|
c5fddb95ed | ||
|
|
c02520ed99 | ||
|
|
8da100f652 | ||
|
|
b76326bf94 | ||
|
|
50877717c8 | ||
|
|
47299421df | ||
|
|
0792acc130 | ||
|
|
c8b2f7a37b | ||
|
|
dea8e96bd5 | ||
|
|
dda2fbd1ec | ||
|
|
a02f3dec02 | ||
|
|
5333ec9331 | ||
|
|
32aa3eb012 | ||
|
|
5a06ffd286 | ||
|
|
ccf4ca8929 | ||
|
|
f8603918db | ||
|
|
ec852c1e5a | ||
|
|
63243b1e3b | ||
|
|
5c63bc33fe | ||
|
|
28dc725cfe | ||
|
|
2c9bee2597 | ||
|
|
724a3889bc | ||
|
|
e26ccb34eb | ||
|
|
be01a35ef1 | ||
|
|
a4be9a2578 | ||
|
|
25f2806f23 | ||
|
|
9832bd8917 | ||
|
|
4decc7986e | ||
|
|
6e0ad1eca5 | ||
|
|
b36863b2c0 | ||
|
|
cfa83f6214 | ||
|
|
4778bdbaab | ||
|
|
c03553ed4a | ||
|
|
4477d0a4e5 | ||
|
|
4dfa51ae03 | ||
|
|
ce7c86cc58 | ||
|
|
a74c6c6314 | ||
|
|
b73426aaca | ||
|
|
aa08f33f98 | ||
|
|
c631627403 | ||
|
|
2363243964 | ||
|
|
78dbb5bfbe | ||
|
|
1a0af611cb | ||
|
|
481622ff16 | ||
|
|
9840966d72 | ||
|
|
c3fc2dd259 | ||
|
|
f33a0aa47b | ||
|
|
bb9e72885a | ||
|
|
2d9f953d4c | ||
|
|
820dfb0495 | ||
|
|
5ec2c96f02 | ||
|
|
3e30196917 | ||
|
|
cc1b9da235 | ||
|
|
1444d9033a | ||
|
|
e60e82c729 | ||
|
|
582a53f3f4 | ||
|
|
4e6cf21d82 | ||
|
|
46fd297c3a | ||
|
|
ed8a3f3199 | ||
|
|
22fdecba52 | ||
|
|
4f9e552148 | ||
|
|
e656222188 | ||
|
|
eb6a6b1a23 | ||
|
|
2bb49ff386 | ||
|
|
86b39bf3e3 | ||
|
|
0c0254453f | ||
|
|
601a2b8c74 | ||
|
|
490ed74187 | ||
|
|
af5ae235e6 | ||
|
|
8d239a3739 | ||
|
|
ed5c728c52 | ||
|
|
f1ffe19506 | ||
|
|
ccf55045a6 | ||
|
|
1e61cf5cba | ||
|
|
77677eb71d | ||
|
|
7c520ece69 | ||
|
|
9dce786113 | ||
|
|
6d706378a0 | ||
|
|
170c46c06b | ||
|
|
af61205e72 | ||
|
|
1cb31f2b11 | ||
|
|
5cd116d078 | ||
|
|
992d1182db | ||
|
|
38aced9f90 | ||
|
|
b1610df282 | ||
|
|
5ce25688e0 | ||
|
|
1b70385d4a | ||
|
|
6cc24a11fd | ||
|
|
6a4062a8c7 | ||
|
|
c91f83fbad | ||
|
|
ffc72ac5f9 | ||
|
|
efdd645dbc | ||
|
|
4dd3d1a1a2 | ||
|
|
a0df2cbb10 | ||
|
|
cb44e165e5 | ||
|
|
0342ddb548 | ||
|
|
fe4211d5b5 | ||
|
|
d70964a608 | ||
|
|
106bae6457 | ||
|
|
65c19bc0e0 | ||
|
|
2dc7db4730 | ||
|
|
fc1d0fedea | ||
|
|
64fd0baa02 | ||
|
|
aed5bf7cc7 | ||
|
|
91a9c39746 | ||
|
|
b7c3945437 | ||
|
|
2ae7c5a547 | ||
|
|
f58013c089 | ||
|
|
861e63ce8e | ||
|
|
ee7825df7b | ||
|
|
41ca8edf23 | ||
|
|
c73646da00 | ||
|
|
d9a85560a2 | ||
|
|
8081d7b15c | ||
|
|
c8f166f696 | ||
|
|
a69cf7e71c | ||
|
|
6497d11049 | ||
|
|
77cf995165 | ||
|
|
1175866033 | ||
|
|
81897dd138 | ||
|
|
5fedbbf7f0 | ||
|
|
991b853bd9 | ||
|
|
52d2e2ee4e | ||
|
|
06d9faedc6 | ||
|
|
0ad445651e | ||
|
|
babac7368b | ||
|
|
aded42f232 | ||
|
|
46ff4b3862 | ||
|
|
b5b2e51fc5 | ||
|
|
8a1d53eb3a | ||
|
|
f4311269d7 | ||
|
|
b9ecf45683 | ||
|
|
b257b10281 | ||
|
|
9fb63adfa5 | ||
|
|
ace89395b6 | ||
|
|
913ef867be | ||
|
|
fc9b8a0214 | ||
|
|
6da48dbd93 | ||
|
|
1be2a55a39 | ||
|
|
ab57c076e3 | ||
|
|
94869e720e | ||
|
|
f65b790e9d | ||
|
|
fa44921241 | ||
|
|
088454b145 | ||
|
|
4571a9e50e | ||
|
|
95c82c7c0b | ||
|
|
390a4ae4bc | ||
|
|
29aa21a2fd | ||
|
|
217a9d50cd | ||
|
|
751e7a0a66 | ||
|
|
b781acc7ab | ||
|
|
f18733d2be | ||
|
|
4889adce4e | ||
|
|
b5ce5029ea | ||
|
|
9eaee76c33 | ||
|
|
c323047dbe | ||
|
|
d8dcd35316 | ||
|
|
0841940aea | ||
|
|
a320336b5c | ||
|
|
7c23fa364f | ||
|
|
49a7947bcb | ||
|
|
f3159ed4f6 | ||
|
|
3514816d63 | ||
|
|
e5fc88ad37 | ||
|
|
a032e7c392 | ||
|
|
301d1a838f | ||
|
|
2d5d6f99ab | ||
|
|
2e71497e10 | ||
|
|
c19650b00f | ||
|
|
6d418d9132 | ||
|
|
f48c78c9ee | ||
|
|
b130b98086 | ||
|
|
385217e55c | ||
|
|
489ce1c8a9 | ||
|
|
95493917f2 | ||
|
|
a5d462e176 | ||
|
|
00523064b0 | ||
|
|
329af44f35 | ||
|
|
a04775f862 | ||
|
|
ab56e4a9f1 | ||
|
|
f01694e274 | ||
|
|
e02da89337 | ||
|
|
6d02036092 | ||
|
|
5017aeb06c | ||
|
|
53d454c813 | ||
|
|
cb0fdd80d0 | ||
|
|
27f34a5487 | ||
|
|
bbf1946dfe | ||
|
|
76f90054f9 | ||
|
|
42d0a2169e | ||
|
|
b31a4399c7 | ||
|
|
b9d3ce2e10 | ||
|
|
ff55d737d5 | ||
|
|
57b4d39749 | ||
|
|
00b4ca3b74 | ||
|
|
4130cf9b40 | ||
|
|
79d53d3b8a | ||
|
|
e08b853a0c | ||
|
|
27b55a74d7 | ||
|
|
88c762e256 | ||
|
|
dee3693ea0 | ||
|
|
cfa627ae62 | ||
|
|
64646182b2 | ||
|
|
56b01bf0e6 | ||
|
|
4da4792844 | ||
|
|
7a9419ce35 | ||
|
|
40ba6b4ec1 | ||
|
|
a65e8b4a22 | ||
|
|
d4f7d67655 | ||
|
|
875c9e18ab | ||
|
|
6166ba7e13 | ||
|
|
e624ae8aea | ||
|
|
ceec572cb9 | ||
|
|
bc7b2f9a67 | ||
|
|
291859c199 | ||
|
|
000c105303 | ||
|
|
030ead9c36 | ||
|
|
857d8eda3a | ||
|
|
a94fcb87d2 | ||
|
|
55bf436f8f | ||
|
|
fc6ddfd78a | ||
|
|
b13c24d7b9 | ||
|
|
3c0b94047c | ||
|
|
1722f28971 | ||
|
|
d82d124152 | ||
|
|
1898077f79 | ||
|
|
f60579ddda | ||
|
|
2d321b22b7 | ||
|
|
493ea93469 | ||
|
|
2110f7d18c | ||
|
|
2d5e38f30a | ||
|
|
12328d6e58 | ||
|
|
b5ca4b4430 | ||
|
|
644c6f9134 | ||
|
|
b4bc76f8eb | ||
|
|
5ff165a1e2 | ||
|
|
1efd06a87d | ||
|
|
46b6207f05 | ||
|
|
c71f48b5f1 | ||
|
|
2b33bc289f | ||
|
|
42ddc4c9e8 | ||
|
|
664880db62 | ||
|
|
22179c493e | ||
|
|
204649521b | ||
|
|
54842cdca9 | ||
|
|
fdec88de99 | ||
|
|
4f40b3befc | ||
|
|
b47418533a | ||
|
|
758cd24033 | ||
|
|
027effd585 | ||
|
|
ca7ee68656 | ||
|
|
72f7cbfdc1 | ||
|
|
5e175ef24c | ||
|
|
02dcc40acd | ||
|
|
9abc9ad1b3 | ||
|
|
767751599e | ||
|
|
82d343fa00 | ||
|
|
e0fed46561 | ||
|
|
d74d61e97e | ||
|
|
81207783a2 | ||
|
|
c65065177f | ||
|
|
bc63617da2 | ||
|
|
31e768f134 | ||
|
|
e02fb2eb6c | ||
|
|
0d9ab27b02 | ||
|
|
0af7ca7b27 | ||
|
|
350be4a549 | ||
|
|
55237ad67d | ||
|
|
52b55ccfbc | ||
|
|
79aa9edde1 | ||
|
|
c485928a9f | ||
|
|
6eb1ac4452 | ||
|
|
876e1744b1 | ||
|
|
2c241d2801 | ||
|
|
73815e2ed0 | ||
|
|
f9c0ddf46d | ||
|
|
5296b8be90 | ||
|
|
a97a513390 | ||
|
|
318f2460ee | ||
|
|
c3ab38ed6f | ||
|
|
9fe4a99365 | ||
|
|
884fc333a1 | ||
|
|
902d174d21 | ||
|
|
b222ff9477 | ||
|
|
baa2355e4e | ||
|
|
ea99d5e0d9 | ||
|
|
23aa6c44a9 | ||
|
|
523906c54f | ||
|
|
c19ff0388e | ||
|
|
6413c063ed | ||
|
|
051d3bb601 | ||
|
|
08cebb3c2f | ||
|
|
b7fd0e81fd | ||
|
|
21f60fe8df | ||
|
|
523433f26c | ||
|
|
c089993a0f | ||
|
|
f8c98715c3 | ||
|
|
3347146a44 | ||
|
|
6b7f23f9f0 | ||
|
|
25299400fa | ||
|
|
11433d942d | ||
|
|
982268a201 | ||
|
|
4832db0b11 | ||
|
|
64ec73cbda | ||
|
|
808b0ad8cd | ||
|
|
0db58430ca | ||
|
|
81e86a35fe | ||
|
|
0512132b91 | ||
|
|
32bcd4b3bf | ||
|
|
d983cfabe2 | ||
|
|
254adf9dc8 | ||
|
|
ef5e5a1a21 | ||
|
|
fb2ce4f0dc | ||
|
|
065caa30f4 | ||
|
|
a1fd038d2c | ||
|
|
78d6d31697 | ||
|
|
9576518d69 | ||
|
|
6541ceb5f5 | ||
|
|
35f6671ec5 | ||
|
|
a17fdf6224 | ||
|
|
abf33ba11c | ||
|
|
c3ad7af06c | ||
|
|
1253c78011 | ||
|
|
8309ac72da | ||
|
|
5dc68d0070 | ||
|
|
74a4d06d58 | ||
|
|
8f0ac668da | ||
|
|
3aa7f24e74 | ||
|
|
64da351ed9 | ||
|
|
da35675c17 | ||
|
|
f8076fee5e | ||
|
|
bcf04d5e93 | ||
|
|
80ceaa47da | ||
|
|
4e568c1899 | ||
|
|
38db8c2109 | ||
|
|
234a55da6a | ||
|
|
f178219d45 | ||
|
|
5cc2129c73 | ||
|
|
8de9b2e149 | ||
|
|
c7514faf4a | ||
|
|
f5d1d0d27a | ||
|
|
d3acb783b9 | ||
|
|
66ef8886c6 | ||
|
|
08ac9897bb | ||
|
|
6b1e81c410 | ||
|
|
511b1391b4 | ||
|
|
87637c9bae | ||
|
|
5db661a9e4 | ||
|
|
8b9f1b36bd | ||
|
|
fde7ba78f2 | ||
|
|
b0db8cf2d8 | ||
|
|
a5f05353b3 | ||
|
|
9a30e02962 | ||
|
|
1d1931333a | ||
|
|
8d75cdf7fe | ||
|
|
f413d0ebcc | ||
|
|
98b8316c0c | ||
|
|
f733ff0196 | ||
|
|
10d2398173 | ||
|
|
32941fdd20 | ||
|
|
7c2306baec | ||
|
|
404585ce8c | ||
|
|
78eecd7d7e | ||
|
|
fadcf799de | ||
|
|
8bfbfdfc79 | ||
|
|
843672f4fe | ||
|
|
e8f3fc33bb | ||
|
|
89266f9062 | ||
|
|
c589d8a251 | ||
|
|
f0e327f979 | ||
|
|
c0ae3dd31e | ||
|
|
dda9689ca4 | ||
|
|
f968fe0136 | ||
|
|
1164450dac | ||
|
|
aa42318395 | ||
|
|
488a51d619 | ||
|
|
12e5f3855c | ||
|
|
62a23bfbde | ||
|
|
b026def961 | ||
|
|
c803e3af55 | ||
|
|
662c3edacc | ||
|
|
355b97165c | ||
|
|
d81dfe266e | ||
|
|
77a57c0e7e | ||
|
|
a291d0d0f8 | ||
|
|
617091e747 | ||
|
|
cb15310d6a | ||
|
|
1c0abbd74b | ||
|
|
7813bd8ac0 | ||
|
|
ad8205f930 | ||
|
|
f9dd485582 | ||
|
|
d0f309b947 | ||
|
|
400b4567f0 | ||
|
|
ba4cc326c2 | ||
|
|
cb8f9756e3 | ||
|
|
b8561cda5e | ||
|
|
7125fe5554 | ||
|
|
4a30979622 | ||
|
|
b28673368b | ||
|
|
de1637c3de | ||
|
|
0eb0b89431 | ||
|
|
96cd8e9ca0 | ||
|
|
9f26d0ced3 | ||
|
|
b7d0925d6b | ||
|
|
2b8e01bff7 | ||
|
|
686db5d452 | ||
|
|
36fd8da1c0 | ||
|
|
45506d1f39 | ||
|
|
2d9746621a | ||
|
|
3c14435109 | ||
|
|
4cf31b0b86 | ||
|
|
c501784541 | ||
|
|
4b7c5dab0e | ||
|
|
c477f6eb6f | ||
|
|
f25827c5b6 | ||
|
|
355003b400 | ||
|
|
6a9d59ea97 | ||
|
|
2f50cb92b6 | ||
|
|
c24665b593 | ||
|
|
973e9cb548 | ||
|
|
763393f70a | ||
|
|
2c11473816 | ||
|
|
40d325366b | ||
|
|
51f7628078 | ||
|
|
4161a7ec6a | ||
|
|
ed767cb703 | ||
|
|
0442122d34 | ||
|
|
327b9eab87 | ||
|
|
3ee594140b | ||
|
|
15694fa2f7 | ||
|
|
07f6675376 | ||
|
|
32327f8f7c | ||
|
|
a050faf084 | ||
|
|
0a37d82444 | ||
|
|
3d2d072927 | ||
|
|
44663b5e8e | ||
|
|
db43eb4cb9 | ||
|
|
cff70e75b7 | ||
|
|
2d328d8a7f | ||
|
|
c010f5895a | ||
|
|
33f1087584 | ||
|
|
975430d5e6 | ||
|
|
56ef079e6f | ||
|
|
0308a2806a | ||
|
|
175945b0bd | ||
|
|
2ee67441c8 | ||
|
|
6fd03d5f20 | ||
|
|
a3a928c7f1 | ||
|
|
bca920c1c1 | ||
|
|
6b09e6ee34 | ||
|
|
2a7811bf2f | ||
|
|
e627c1f8a8 | ||
|
|
fe7348cc53 | ||
|
|
b066902705 | ||
|
|
64eb415ec0 | ||
|
|
e912a6f5da | ||
|
|
3288426f2b | ||
|
|
0a7d98871c | ||
|
|
ed7b14899f | ||
|
|
7b6338c4b6 | ||
|
|
a0f991dbad | ||
|
|
c84012edec | ||
|
|
7f571f5e5a | ||
|
|
d4227051a9 | ||
|
|
3d373e2a16 | ||
|
|
38e6695627 | ||
|
|
8bd6515564 | ||
|
|
8fedec785a | ||
|
|
7cf6ca80a6 | ||
|
|
abc38cf17f | ||
|
|
0ba8c44260 | ||
|
|
1adaba3865 | ||
|
|
35ec6bb613 | ||
|
|
3d4d5ab0df | ||
|
|
bcc4125a18 | ||
|
|
7f9ea04286 | ||
|
|
317f64a11f | ||
|
|
a3e55634d6 | ||
|
|
9bf53676b8 | ||
|
|
41d1a427b0 | ||
|
|
853a07112b | ||
|
|
a8555d811d | ||
|
|
538de55607 | ||
|
|
57ccd7e65c | ||
|
|
a9033912b3 | ||
|
|
373a34a144 | ||
|
|
9324c2a9b4 | ||
|
|
fb2931801e | ||
|
|
8ac6b266c9 | ||
|
|
efe5d13ed6 | ||
|
|
a9963e3841 | ||
|
|
f1d104e004 | ||
|
|
996f99b267 | ||
|
|
62d2ea8034 | ||
|
|
ed15c70cd0 | ||
|
|
cf6b20429a | ||
|
|
324336e7f6 | ||
|
|
d240b1fe15 | ||
|
|
c333bd144e | ||
|
|
53d60cac4f | ||
|
|
6271046a27 | ||
|
|
8a81a437d2 | ||
|
|
a453a78c7c | ||
|
|
bdd7f8f8a2 | ||
|
|
d232948188 | ||
|
|
35d5ac6e8f | ||
|
|
fdd08215ea | ||
|
|
ff7cfa732f | ||
|
|
45be14ed6f | ||
|
|
11a3eaec26 | ||
|
|
7832f2ae7e | ||
|
|
6eb349f5d2 | ||
|
|
ff169d32fe | ||
|
|
404ecaf95b | ||
|
|
1de14e6a93 | ||
|
|
492bda1343 | ||
|
|
4d6871d917 | ||
|
|
c4ab96b638 | ||
|
|
fed6cfbf4d | ||
|
|
2a27b123fd | ||
|
|
7c5151e8e7 | ||
|
|
a189c238cc | ||
|
|
d427bb8603 | ||
|
|
7eed89a0df | ||
|
|
5d9699bbdc | ||
|
|
e6cce7a5bd | ||
|
|
d79e1bbaad | ||
|
|
bf1744eea2 | ||
|
|
9427e1efe8 | ||
|
|
661af1dc1a | ||
|
|
a5bc99d53e | ||
|
|
14fae695bf | ||
|
|
be04142723 | ||
|
|
748c65f7a7 | ||
|
|
2fc9f6bbc9 | ||
|
|
65bf3ab201 | ||
|
|
906fcd7328 | ||
|
|
7b819852b9 | ||
|
|
9217a2523d | ||
|
|
0aedef07c3 | ||
|
|
3e60a9eb9c | ||
|
|
798dc4ae1d | ||
|
|
632d9893b0 | ||
|
|
809d9863bf | ||
|
|
742cbeaee1 | ||
|
|
2159c80270 | ||
|
|
8e9446d3fb | ||
|
|
a7da521a62 | ||
|
|
2621fe2bff | ||
|
|
3843a40f7c | ||
|
|
f647352d01 | ||
|
|
1631f0f5ae | ||
|
|
b4eb8663af | ||
|
|
e1528ce3be | ||
|
|
1360e77cb2 | ||
|
|
9921099546 | ||
|
|
2f6b5feb1a | ||
|
|
d569a2d6bc | ||
|
|
e3ba495ed9 | ||
|
|
d4a77cf2af | ||
|
|
3a2eaa67a2 | ||
|
|
f3ad56f103 | ||
|
|
c3e6c41fc1 | ||
|
|
8a055c5d42 | ||
|
|
06e4971fe7 | ||
|
|
e28c1c9bfa | ||
|
|
3550ac7473 | ||
|
|
51800bf36f | ||
|
|
c89a3e207e | ||
|
|
365c64fe3b | ||
|
|
6b652f766d | ||
|
|
5a8a8f2bd3 | ||
|
|
821cbb3e08 | ||
|
|
f8798aee28 | ||
|
|
11cd2b8253 | ||
|
|
1677c688cb | ||
|
|
b92feb3f0a | ||
|
|
7d4d91f013 | ||
|
|
3279906737 | ||
|
|
c7b1bc8197 | ||
|
|
da288ad57a | ||
|
|
03ae9bee74 | ||
|
|
a364395612 | ||
|
|
37f3a29d49 | ||
|
|
48396f97a9 | ||
|
|
ccd19c53c8 | ||
|
|
2bae0d295b | ||
|
|
8755969629 | ||
|
|
e12d053ab8 | ||
|
|
13b07cb5d8 | ||
|
|
d3adc9d334 | ||
|
|
751e2ea2d4 | ||
|
|
dab3df7619 | ||
|
|
171b370b0e | ||
|
|
bcbc1be1c8 | ||
|
|
04c329d703 | ||
|
|
9a62aa6380 | ||
|
|
11e5c8eab7 | ||
|
|
775b6f6f00 | ||
|
|
dacc1d8aaf | ||
|
|
18591920f3 | ||
|
|
193eb42891 | ||
|
|
b20d171c1c | ||
|
|
590211e13e | ||
|
|
fff5269d1a | ||
|
|
e831947be4 | ||
|
|
c205ce658f | ||
|
|
13060f89c7 | ||
|
|
f25901874a | ||
|
|
3cc6acaca4 | ||
|
|
21ccf8f8c0 | ||
|
|
b973d08b0e | ||
|
|
d24ee0e1dc | ||
|
|
afb1bd103a | ||
|
|
4c1852f928 | ||
|
|
6e26f5754b | ||
|
|
82d1b340dc | ||
|
|
eab2ab9faa | ||
|
|
12427e3434 | ||
|
|
76bf523a1f | ||
|
|
613816dd9d | ||
|
|
f8ec2544ce | ||
|
|
3c2f52d681 | ||
|
|
3baf3ab069 | ||
|
|
5c575b30c2 | ||
|
|
e65f52aae4 | ||
|
|
44277441d6 | ||
|
|
7b68c124d5 | ||
|
|
f2172922c5 | ||
|
|
079a825ac3 | ||
|
|
9cf9d76eb5 | ||
|
|
dc7029ec98 | ||
|
|
f0019c06d7 | ||
|
|
a094ad8f31 | ||
|
|
d6827a37d0 | ||
|
|
5b7a79b0ff | ||
|
|
ee861f4287 | ||
|
|
0c0bab3ad0 | ||
|
|
1c73ec22e9 | ||
|
|
4677ba5cd9 | ||
|
|
093709be4d | ||
|
|
f6ed16bbbe | ||
|
|
fc618aa78a | ||
|
|
82e69de44f | ||
|
|
8f8062723a | ||
|
|
cc4381b91e | ||
|
|
eae641485b | ||
|
|
29309201b6 | ||
|
|
0dd6c40205 | ||
|
|
84d9a1b577 | ||
|
|
17170a2ca7 | ||
|
|
8d34538f4c | ||
|
|
8d1a85a8d0 | ||
|
|
06f048e507 | ||
|
|
83a9f2c740 | ||
|
|
bc5cc0dc92 | ||
|
|
6562137731 | ||
|
|
d078b69aef | ||
|
|
0a1e527aec | ||
|
|
9f55f503b1 | ||
|
|
253cba373b | ||
|
|
9451ae2e98 | ||
|
|
d203349740 | ||
|
|
4aad69594d | ||
|
|
c7f165ae6f | ||
|
|
98cbde1324 | ||
|
|
77e5443f71 | ||
|
|
e15ae8f9a7 | ||
|
|
0eb2509449 | ||
|
|
bd0e002804 | ||
|
|
0e65dff008 | ||
|
|
fba77fc65f | ||
|
|
1cf5ec872c | ||
|
|
21c2146be4 | ||
|
|
2f91d8e773 | ||
|
|
946f7ec579 | ||
|
|
658d609e9f | ||
|
|
abca7f0ad0 | ||
|
|
cf5ddecc4c | ||
|
|
c1a44259d6 | ||
|
|
54b2cb0b27 | ||
|
|
09b6aef835 | ||
|
|
228c5e68ae | ||
|
|
6bb0529bed | ||
|
|
1532effb68 | ||
|
|
65eaebb177 | ||
|
|
ab0714ce9c | ||
|
|
a3a7c504ad | ||
|
|
ca45da39fa | ||
|
|
313ff95ee4 | ||
|
|
97815c9930 | ||
|
|
e2645826be | ||
|
|
7cc898f9ed | ||
|
|
ec979dc60a | ||
|
|
32a6d07036 | ||
|
|
d6c2d8f1dc | ||
|
|
4a5c94f410 | ||
|
|
0eb5b633aa | ||
|
|
56c36ac27d | ||
|
|
508bd26741 | ||
|
|
835053c55e | ||
|
|
f0e0a62bbe | ||
|
|
bdcbabb758 | ||
|
|
7cc2d468c7 | ||
|
|
83f4c01564 | ||
|
|
cfeb485434 | ||
|
|
d3b7f98814 | ||
|
|
f5b0043c08 | ||
|
|
6ce27f7d55 | ||
|
|
531dc35126 | ||
|
|
d974b46dbe | ||
|
|
ea1d5f3648 | ||
|
|
83b4081e85 | ||
|
|
e18e79d820 | ||
|
|
7234c7240a | ||
|
|
7fa6276eb7 | ||
|
|
bbdf81dc1c | ||
|
|
4b0d53dcb7 | ||
|
|
746d2cad5d | ||
|
|
14f57f6585 | ||
|
|
e63dff0a3a | ||
|
|
09c0365255 | ||
|
|
1661bf6543 | ||
|
|
2ef0b1b51d | ||
|
|
3c58600187 | ||
|
|
572c15d049 | ||
|
|
99a6074816 | ||
|
|
8b750ee182 | ||
|
|
c9b4920230 | ||
|
|
793d314c8d | ||
|
|
8c873712fe | ||
|
|
faae6b87b1 | ||
|
|
fd7610dd7a | ||
|
|
b0e1865073 | ||
|
|
de0658f7e8 | ||
|
|
79bb9ee141 | ||
|
|
2f33679cb3 | ||
|
|
6f5735274b | ||
|
|
709828204a | ||
|
|
b355b678a9 | ||
|
|
124c172c72 | ||
|
|
709c8bdcbf | ||
|
|
2c55d269ce | ||
|
|
e0d1b09ffe | ||
|
|
ceb42dd5de | ||
|
|
80fe5dc147 | ||
|
|
d806ffc1cd | ||
|
|
4f75f1f41d | ||
|
|
fe10eeb5be | ||
|
|
cf37f63ccb | ||
|
|
e7efce91fb | ||
|
|
5f834715d0 | ||
|
|
dd89df314d | ||
|
|
fdbb53db19 | ||
|
|
590ce29743 | ||
|
|
7548bc7ccc | ||
|
|
544ebf402f | ||
|
|
640538adcb | ||
|
|
1ded0ad3d5 | ||
|
|
d339b0f64f | ||
|
|
8e2696b385 | ||
|
|
b5212ddc3d | ||
|
|
dacaae520a | ||
|
|
e663c77e70 | ||
|
|
ec109c9ac8 | ||
|
|
0b9a2a1581 | ||
|
|
2759060559 | ||
|
|
00b13673e3 | ||
|
|
91ac5ba110 | ||
|
|
0d8c08cd22 | ||
|
|
ab4c03adc3 | ||
|
|
75b0c4be1b | ||
|
|
4a8e6415c7 | ||
|
|
58bf158840 | ||
|
|
c0f066626e | ||
|
|
69c7a8638e | ||
|
|
1b6f1b091c | ||
|
|
d39cdc45d1 | ||
|
|
7f761f3adf | ||
|
|
5e76943f02 | ||
|
|
b887ea3b60 | ||
|
|
690426ac86 | ||
|
|
b8298b0710 | ||
|
|
3bd5406c06 | ||
|
|
3ae0ff3685 | ||
|
|
80e29bfcab | ||
|
|
d7107c2cdc | ||
|
|
658da765ec | ||
|
|
9e2f5dd0ed | ||
|
|
1ffce4f7dc | ||
|
|
fcac1c3746 | ||
|
|
c0763bb8d5 | ||
|
|
75bd9d0e94 | ||
|
|
08bc1198d3 | ||
|
|
cf54f60367 | ||
|
|
329efcae6e | ||
|
|
5a2a78f7df | ||
|
|
f72c13ffda | ||
|
|
0a17badb21 | ||
|
|
12f9aa3669 | ||
|
|
afa2e86a4d | ||
|
|
b7842ab34b | ||
|
|
f8b3141204 | ||
|
|
c40d6d0509 | ||
|
|
a74481a1d4 | ||
|
|
b898415d0d | ||
|
|
b47effe5d8 | ||
|
|
4f10605389 | ||
|
|
120e62900b | ||
|
|
986704dc62 | ||
|
|
2f13956357 | ||
|
|
8d700dd1e5 | ||
|
|
5be412db13 | ||
|
|
a61a861cfb | ||
|
|
c363ca476f | ||
|
|
319b1ed551 | ||
|
|
67f50a0fe5 | ||
|
|
b98cc8b4e9 | ||
|
|
495646bb6a | ||
|
|
4516bd45b2 | ||
|
|
730c0e2e2b | ||
|
|
3020d0e56a | ||
|
|
49bed18a83 | ||
|
|
e6959412aa | ||
|
|
04c0bcc9b4 | ||
|
|
ec4edae977 | ||
|
|
f478c34671 | ||
|
|
a0ef4f2358 | ||
|
|
ca57e93ebf | ||
|
|
5ca5b7ec65 | ||
|
|
2b202aabd7 | ||
|
|
cb64d31171 | ||
|
|
80eafe3b63 | ||
|
|
16aa444261 | ||
|
|
0bbdbac17f | ||
|
|
c430b60e38 | ||
|
|
02f6555536 | ||
|
|
4293e3fdb2 | ||
|
|
50298bbf97 | ||
|
|
ac82fa47a0 | ||
|
|
976bfbf687 | ||
|
|
1bc377b188 | ||
|
|
a89530aef5 | ||
|
|
c32b1cd6d6 | ||
|
|
90f5c8bd85 | ||
|
|
878bb61d24 | ||
|
|
8493d8329e | ||
|
|
57aeafa115 | ||
|
|
a29e862adf | ||
|
|
5ed62e1137 | ||
|
|
f99a2534c9 | ||
|
|
a939423006 | ||
|
|
4493acc5ee | ||
|
|
c4eb9301bb | ||
|
|
57ba337e79 | ||
|
|
3d542693bc | ||
|
|
5f2607ffca | ||
|
|
ab916a8a8d | ||
|
|
1fb4bd82f7 | ||
|
|
d892e93589 | ||
|
|
38c2532c5f | ||
|
|
18b5ee7d5b | ||
|
|
9fd2d07c1d | ||
|
|
e7bcc3b332 | ||
|
|
b001fcf968 | ||
|
|
125619c783 | ||
|
|
fe6882623c | ||
|
|
11c4315da3 | ||
|
|
672e66ba5f | ||
|
|
bcfddb3d65 | ||
|
|
9cae98c167 | ||
|
|
b0e2e4f284 | ||
|
|
36842db26f | ||
|
|
e84a7c7e6f | ||
|
|
2109afc144 | ||
|
|
786dfdd7e5 | ||
|
|
62d05f842d | ||
|
|
fc3b03a5f5 | ||
|
|
f4f2bd9fab | ||
|
|
b0555b68e7 | ||
|
|
497695864b | ||
|
|
128b49a1fb | ||
|
|
0dbda6665d | ||
|
|
464279f48d | ||
|
|
b14a244ab4 | ||
|
|
2c7e920298 | ||
|
|
b725bfd3fb | ||
|
|
47e96b8040 | ||
|
|
9a1348707c | ||
|
|
ada98899f8 | ||
|
|
16a7a26452 | ||
|
|
2c04f9d199 | ||
|
|
70e98e47cf | ||
|
|
b525dc29f7 | ||
|
|
a3fb5ac326 | ||
|
|
8e6f98f44e | ||
|
|
9ba93b885c | ||
|
|
5f44d79729 | ||
|
|
a3b26c7e5b | ||
|
|
e9be7c1a58 | ||
|
|
6c359b2457 | ||
|
|
7647e52943 | ||
|
|
a0ae2e6c7b | ||
|
|
efd2b57b92 | ||
|
|
47aba0cc20 | ||
|
|
f5a2b75924 | ||
|
|
49a38ac89a | ||
|
|
6d071f4331 | ||
|
|
3873121c01 | ||
|
|
5bff8e362f | ||
|
|
62733146be | ||
|
|
99f6581770 | ||
|
|
b37fbf30a3 | ||
|
|
e65d0ac9e3 | ||
|
|
61a0e85672 | ||
|
|
c18e6459a8 | ||
|
|
6db255d17d | ||
|
|
49d79546e8 | ||
|
|
f3ba022f46 | ||
|
|
17f2002839 | ||
|
|
a6ee9757a7 | ||
|
|
d9cb18ad2a | ||
|
|
557480cfe8 | ||
|
|
5dae0bb9bf | ||
|
|
e38046e6c6 | ||
|
|
97be9ee4cd | ||
|
|
c658b363e3 | ||
|
|
7f9cef0114 | ||
|
|
8efb6cc870 | ||
|
|
1c8a141711 | ||
|
|
4d38790b5b | ||
|
|
5cfbb0aaf5 | ||
|
|
29271a4100 | ||
|
|
df0dc2b67a | ||
|
|
ff286f351c | ||
|
|
430125b396 | ||
|
|
0536e5b708 | ||
|
|
e6990162e5 | ||
|
|
d9b304b906 | ||
|
|
79f5d532c6 | ||
|
|
6af6a08b7a | ||
|
|
96d5044722 | ||
|
|
4258201900 | ||
|
|
11e5126454 | ||
|
|
9e953f3320 | ||
|
|
bbbeedb0a2 | ||
|
|
de17f4e5a4 | ||
|
|
86eba21b8a | ||
|
|
53d679edba | ||
|
|
89c90add2c | ||
|
|
a869be1e5a | ||
|
|
68619b8088 | ||
|
|
534cdd7587 | ||
|
|
e185aec920 | ||
|
|
14e8eea0ee | ||
|
|
2b849545ea | ||
|
|
15396fb2f9 | ||
|
|
1acef81ed3 | ||
|
|
a25141f9f4 | ||
|
|
d339ffe9d9 | ||
|
|
c5ba5888b5 | ||
|
|
3415e6de0b | ||
|
|
638532dd9a | ||
|
|
c6fc7d99b5 | ||
|
|
281e0598bc | ||
|
|
aa39fb0c80 | ||
|
|
459a91c54f | ||
|
|
115b51e68c | ||
|
|
4441697e49 | ||
|
|
5174ab4325 | ||
|
|
95911f059a | ||
|
|
e3288d5e33 | ||
|
|
49140d6880 | ||
|
|
9c6ffc5303 | ||
|
|
f80984f377 | ||
|
|
9c0a0fbd01 | ||
|
|
57dbab2932 | ||
|
|
7fdb541e2d | ||
|
|
082f4d8948 | ||
|
|
8aa015ffc9 | ||
|
|
cfb1a478ac | ||
|
|
28db6c3f53 | ||
|
|
5f768b191d | ||
|
|
d9a9a981bc | ||
|
|
9fcfec18da | ||
|
|
a83268b01b | ||
|
|
a1afbfbaa3 | ||
|
|
4114b04521 | ||
|
|
f7e67c01ea | ||
|
|
544a5fea59 | ||
|
|
0a8bb2e1b3 | ||
|
|
5184f0c5a9 | ||
|
|
9a1a4136ac | ||
|
|
ca26c1a253 | ||
|
|
a91ac242f3 | ||
|
|
31d495fb02 | ||
|
|
bdda99c0c1 | ||
|
|
9ed93044e0 | ||
|
|
0bfc029b5e | ||
|
|
4eb2759400 | ||
|
|
0001f5b651 | ||
|
|
e1615e0f1e | ||
|
|
3483bae24f | ||
|
|
716d29c49c | ||
|
|
a7223f86a9 | ||
|
|
2c0ff95d4d | ||
|
|
91766548d1 | ||
|
|
12f3c65e5a | ||
|
|
f5e421e880 | ||
|
|
9d88ac7b50 | ||
|
|
75dc012f41 | ||
|
|
f214b91d77 | ||
|
|
f80fbad4ff | ||
|
|
2e38f54b39 | ||
|
|
2c153c1556 | ||
|
|
70fbd27d5c | ||
|
|
c910b958f0 | ||
|
|
6ce4ece8aa | ||
|
|
5be6c21b14 | ||
|
|
8207ed074e | ||
|
|
f8cf713f41 | ||
|
|
8f58c095c5 | ||
|
|
5937282618 | ||
|
|
a3b8ef15db | ||
|
|
4e2ecd6987 | ||
|
|
814e0520ad | ||
|
|
19a2a6c6d1 | ||
|
|
0e711f2f9d | ||
|
|
5e60279a19 | ||
|
|
6fb2674446 | ||
|
|
5a3aae73ba | ||
|
|
47510486ec | ||
|
|
c3bba1543b | ||
|
|
cef1811415 | ||
|
|
21acc6b732 | ||
|
|
ba71e2a3cb | ||
|
|
baf3dcb6c7 | ||
|
|
8b92b6513c | ||
|
|
03ddf26596 | ||
|
|
8c1fd5db95 | ||
|
|
10eed6344c | ||
|
|
06eee390dd | ||
|
|
fad9abfd77 | ||
|
|
a5f79712bb | ||
|
|
c71ac7917a | ||
|
|
4e59f9ec93 | ||
|
|
a6412b02ba | ||
|
|
961f78ab5f | ||
|
|
463ca76cc4 | ||
|
|
f58ab8bc03 | ||
|
|
3a06c35da3 | ||
|
|
37070ac30e | ||
|
|
e56d05d230 | ||
|
|
f1fa8f0064 | ||
|
|
56d6d703f9 | ||
|
|
7fbbdeb324 | ||
|
|
f7e4832472 | ||
|
|
4ed16d99c2 | ||
|
|
02f422d132 | ||
|
|
a76f4925b5 | ||
|
|
c2e942f230 | ||
|
|
c7b99f7819 | ||
|
|
6bb4c4ebe6 | ||
|
|
d1dfa02070 | ||
|
|
ee36baf4f3 | ||
|
|
e85b857a35 | ||
|
|
e7ed1224d2 | ||
|
|
9f29a31f66 | ||
|
|
356bf42373 | ||
|
|
ba00c4411c | ||
|
|
c74b66a53e | ||
|
|
a7a619ba5c | ||
|
|
65c06579b4 | ||
|
|
a5ff4be7b0 | ||
|
|
52ac24120c | ||
|
|
a77b91671c | ||
|
|
a350ceffb9 | ||
|
|
5c72601599 | ||
|
|
99b6e35940 | ||
|
|
8ae4b440e3 | ||
|
|
1933d3c707 | ||
|
|
9d8d1d14f1 | ||
|
|
42b33ae1a1 | ||
|
|
ab23536b1b | ||
|
|
b51640b051 | ||
|
|
6421ec1784 | ||
|
|
296d8cc097 | ||
|
|
bbf1021156 | ||
|
|
8ffe17cb09 | ||
|
|
e17155151b | ||
|
|
1da54de5dc | ||
|
|
8693fc746f | ||
|
|
5309ad005f | ||
|
|
43854067d4 | ||
|
|
5a7fbbb00d | ||
|
|
04ee583822 | ||
|
|
2a7223585e | ||
|
|
58e018af13 | ||
|
|
c165255e98 | ||
|
|
cf60062df1 | ||
|
|
82a5f1dd9b | ||
|
|
c70b7bb012 | ||
|
|
16aa01420b | ||
|
|
e98e61da12 | ||
|
|
cfefcab8e0 | ||
|
|
eb5d191a57 | ||
|
|
3ea9c53826 | ||
|
|
3900243297 | ||
|
|
7fdb09b766 | ||
|
|
81efe1fa88 | ||
|
|
f7fdfe8b9a | ||
|
|
76dacaf231 | ||
|
|
89241c525e | ||
|
|
bf499a80de | ||
|
|
6b129ec0c9 | ||
|
|
1165bec773 | ||
|
|
b79dea97fd | ||
|
|
4504953212 | ||
|
|
2ccc68c4b4 | ||
|
|
7c66e6f267 | ||
|
|
bec201c5ca | ||
|
|
35b0c5e16e | ||
|
|
fc0565fa5d | ||
|
|
289e813ab6 | ||
|
|
8a1b0e1852 | ||
|
|
f0edd4a3e0 | ||
|
|
a64a62088a | ||
|
|
588b6bbf8a | ||
|
|
d3cbf37352 | ||
|
|
6b377cc919 | ||
|
|
e91fe9b2b8 | ||
|
|
45c9ecc82a | ||
|
|
3d49eb40f8 | ||
|
|
9f6246a7b8 | ||
|
|
8f20058d0d | ||
|
|
6e9cb09fff | ||
|
|
9aa62d5622 | ||
|
|
bcc48a9607 | ||
|
|
3458e6a905 | ||
|
|
0086f97b65 | ||
|
|
06b9d154cc | ||
|
|
e8668fb512 | ||
|
|
b40128219f | ||
|
|
14a798882c | ||
|
|
37bbdbe8c3 | ||
|
|
4ab76943ef | ||
|
|
30377ca912 | ||
|
|
0a24de2ef9 | ||
|
|
3462d9c87b | ||
|
|
2584c48e8d | ||
|
|
0a4b7356ac | ||
|
|
ec926a4958 | ||
|
|
e84d84b5b8 | ||
|
|
cfc1a76381 | ||
|
|
6730818ddc | ||
|
|
7ee2b79127 | ||
|
|
58c77bac27 | ||
|
|
40c54800a6 | ||
|
|
3fccf63f49 | ||
|
|
6a23625c11 | ||
|
|
474e17b0af | ||
|
|
f1e8700e9a | ||
|
|
c05c64d21b | ||
|
|
c0d8e8e846 | ||
|
|
58e3dd9de8 | ||
|
|
02408973c6 | ||
|
|
df2c80e28e | ||
|
|
60558fdcc4 | ||
|
|
52b9f01e6e | ||
|
|
b7bb1c7b61 | ||
|
|
7c206c74ba | ||
|
|
50279dd83c | ||
|
|
cdd0613aec | ||
|
|
69e7e94c4c | ||
|
|
f5f2ddfa74 | ||
|
|
ff0f9613f2 | ||
|
|
30ed6643d7 | ||
|
|
d9798f4a3c | ||
|
|
82f2ad6f99 | ||
|
|
6833b326f8 | ||
|
|
afc6561fdb | ||
|
|
81817852ad | ||
|
|
2d8440ea98 | ||
|
|
a348fd7ae3 | ||
|
|
1588ad7c46 | ||
|
|
ae9cdf1a47 | ||
|
|
220f687e6f | ||
|
|
f4296ba758 | ||
|
|
3d6937af7d | ||
|
|
fad1c665a6 | ||
|
|
b17ec8e1df | ||
|
|
d1b6db05a4 | ||
|
|
2999c71e46 | ||
|
|
0b424e1637 | ||
|
|
87239802c1 | ||
|
|
0c4342a3a6 | ||
|
|
bd45bc716a | ||
|
|
dfbfb2303f | ||
|
|
4002efb56a | ||
|
|
f7257eada6 | ||
|
|
02ea563a06 | ||
|
|
341ac9fe8a | ||
|
|
5bc919a24f | ||
|
|
a0c3570640 | ||
|
|
ce42b338f4 | ||
|
|
17088763e7 | ||
|
|
53bf544050 | ||
|
|
e725f30625 | ||
|
|
4e8b680865 | ||
|
|
92a8db6da0 | ||
|
|
2131ba4dda | ||
|
|
7a1a40e445 | ||
|
|
52a95cb93a | ||
|
|
0c4b973dcf | ||
|
|
7192b8022e | ||
|
|
147c24154e | ||
|
|
99f0ef4766 | ||
|
|
35ed9b5f38 | ||
|
|
0f2dcff725 | ||
|
|
5b73f2ea61 | ||
|
|
1d2abea94b | ||
|
|
6a51f6b2f8 | ||
|
|
c48f0d990f | ||
|
|
f9141f51ec | ||
|
|
e649003974 | ||
|
|
358478eb88 | ||
|
|
498b446f14 | ||
|
|
f5bbb9714d | ||
|
|
1031ec4942 | ||
|
|
827b2340a2 | ||
|
|
8de59f03a0 | ||
|
|
73ba48be2e | ||
|
|
72943d0247 | ||
|
|
8c90c610cd | ||
|
|
1a85e110b8 | ||
|
|
12fa108ede | ||
|
|
9c3ca6e740 | ||
|
|
12ada03548 | ||
|
|
daa4fbf4e2 | ||
|
|
6fefffd03e | ||
|
|
7ce305fa89 | ||
|
|
04cdd0f2e7 | ||
|
|
33ee732082 | ||
|
|
d0b96f8e3b | ||
|
|
cf36d8c753 | ||
|
|
bd562a7ab3 | ||
|
|
72c8163aee | ||
|
|
2bae57e0a6 | ||
|
|
f7968b6797 | ||
|
|
4cae63a297 | ||
|
|
628325ae90 | ||
|
|
b3e2410f44 | ||
|
|
a02189a8e9 | ||
|
|
d343fda7f0 | ||
|
|
f9bcf7c611 | ||
|
|
23b0535a0d | ||
|
|
32c7cbf1ad | ||
|
|
8fe6f8c618 | ||
|
|
80c55f5767 | ||
|
|
3efd5dbab4 | ||
|
|
eaf1264879 | ||
|
|
f5592ceb48 | ||
|
|
e32840f631 | ||
|
|
4596c02339 | ||
|
|
4fcf14e124 | ||
|
|
797301a63b | ||
|
|
3615cbc9df | ||
|
|
b8c55da48d | ||
|
|
5b54b3e53f | ||
|
|
e43b438729 | ||
|
|
3326030862 | ||
|
|
8836c4b12a | ||
|
|
3a4f6ba8b3 | ||
|
|
6ac1e02691 | ||
|
|
6140fac6aa | ||
|
|
a957bcfd7b | ||
|
|
73ed950e70 | ||
|
|
6ef5094be6 | ||
|
|
077758f713 | ||
|
|
8b9f689ecc | ||
|
|
428fc9c0bd | ||
|
|
d04f31b302 | ||
|
|
4673d3dfa7 | ||
|
|
a548b6249d | ||
|
|
a9822b0bb6 | ||
|
|
3d3f05884f | ||
|
|
50c39fd95a | ||
|
|
28a9534383 | ||
|
|
c108c5300f | ||
|
|
c60618ae01 | ||
|
|
0008b035e2 | ||
|
|
be69529dca | ||
|
|
dac050bf40 | ||
|
|
e7a7615e0d | ||
|
|
7c271a466f | ||
|
|
95336a0542 | ||
|
|
e257151ffc | ||
|
|
84a2b35b71 | ||
|
|
e15834da8e | ||
|
|
f1bb25b1ec | ||
|
|
6b9cb059f6 | ||
|
|
02cf3dce37 | ||
|
|
4fb72a2e68 | ||
|
|
58b1c69b6a | ||
|
|
8f8dbec0d5 | ||
|
|
e46251b727 | ||
|
|
82cbae479c | ||
|
|
b88fbb5e0c | ||
|
|
68b4830948 | ||
|
|
9966017a49 | ||
|
|
53c7b77735 | ||
|
|
491a3c075d | ||
|
|
4916b1c2ce | ||
|
|
60b37e54b5 | ||
|
|
b7c788cc56 | ||
|
|
12db1576e9 | ||
|
|
af6aa3e572 | ||
|
|
20e0ee4968 | ||
|
|
4892a305d9 | ||
|
|
495c3d5006 | ||
|
|
06a5aed8e2 | ||
|
|
0dae52220b | ||
|
|
d23c4b94c1 | ||
|
|
94c587d642 | ||
|
|
340f7a0733 | ||
|
|
b8d4a5ea61 | ||
|
|
5b5b3def00 | ||
|
|
1a4dfad52d | ||
|
|
b66871e871 | ||
|
|
a74568d8d5 | ||
|
|
302c4d9c41 | ||
|
|
97e3c84084 | ||
|
|
0ee6c1fa68 | ||
|
|
f0fe8b971b | ||
|
|
8c34fa8477 | ||
|
|
6be69e303b | ||
|
|
2f6cf50a6c | ||
|
|
f9dfbb73dd | ||
|
|
903f96cc6a | ||
|
|
5c81fba1eb | ||
|
|
4dc48b6521 | ||
|
|
ab3200b4cc | ||
|
|
185450c5e1 | ||
|
|
958c424c89 | ||
|
|
61be59d996 | ||
|
|
e007a5a13f | ||
|
|
3d29f6535f | ||
|
|
98dc08236c | ||
|
|
4ab0bfefd3 | ||
|
|
e418631ce8 | ||
|
|
4d97cc7506 | ||
|
|
2b3bd78685 | ||
|
|
597ace5718 | ||
|
|
f269c6c89a | ||
|
|
d72d116214 | ||
|
|
d552e6c884 | ||
|
|
77909f1d49 | ||
|
|
dbf70fc40f | ||
|
|
3a6d9b09db | ||
|
|
b19d8785a4 | ||
|
|
41e60b8a00 | ||
|
|
eddf5254fb | ||
|
|
ba5eddcf5e | ||
|
|
d63cd5f547 | ||
|
|
348d2a2d51 | ||
|
|
194ff1ad89 | ||
|
|
3b6904c5ef | ||
|
|
8d0e03ce41 | ||
|
|
baa3f78430 | ||
|
|
4f984b0fe6 | ||
|
|
c5ed4c9953 | ||
|
|
681956e0c4 | ||
|
|
ad6a8d53d6 | ||
|
|
0e9d7aad27 | ||
|
|
6dc664caaf | ||
|
|
98c5ded4f3 | ||
|
|
5568f77ad5 | ||
|
|
cfd38263d1 | ||
|
|
c052029399 | ||
|
|
b7243684de | ||
|
|
055f7c1eb6 | ||
|
|
e27241df73 | ||
|
|
23efd56b12 | ||
|
|
d938f32089 | ||
|
|
7dc75ce3ce | ||
|
|
8c74860fd1 | ||
|
|
492133ba64 | ||
|
|
82e8fdbb29 | ||
|
|
b37b977d20 | ||
|
|
ec94f5030c | ||
|
|
65a765fe88 | ||
|
|
9645e882b2 | ||
|
|
ef1e27ea9f | ||
|
|
6bd8e9e73f | ||
|
|
de4035fb96 | ||
|
|
38bd234936 | ||
|
|
7481980c1a | ||
|
|
a4234e97be | ||
|
|
9b42c954c6 | ||
|
|
d0b9357f1b | ||
|
|
a688f026dc | ||
|
|
60917e0b9f | ||
|
|
f0bcdd075e | ||
|
|
7a0f3638b5 | ||
|
|
12997080a8 | ||
|
|
6e840f46e1 | ||
|
|
12d6697815 | ||
|
|
d85c5356dc | ||
|
|
ff6dbc556b | ||
|
|
35bfa9e91d | ||
|
|
d98de70f4a | ||
|
|
e1dfb7c883 | ||
|
|
15755be3c7 | ||
|
|
84e89429f0 | ||
|
|
daf9b60550 | ||
|
|
1382d655ed | ||
|
|
f0cfba708b | ||
|
|
435bd1242a | ||
|
|
4f6fc98509 | ||
|
|
9011852db0 | ||
|
|
29548bfab6 | ||
|
|
efc267ce59 | ||
|
|
244172bdd4 | ||
|
|
f1f56c3081 | ||
|
|
bfa010383e | ||
|
|
daf7aeb8c3 | ||
|
|
573ab095e4 | ||
|
|
030d877ed5 | ||
|
|
33dec52b8e | ||
|
|
aa31b6b4dd | ||
|
|
46f0146adf | ||
|
|
b14fa0764b | ||
|
|
15511584d1 | ||
|
|
80cd1ee663 | ||
|
|
3161783e49 | ||
|
|
e9b4defe8d | ||
|
|
a4b87c6fc1 | ||
|
|
cc350d54b7 | ||
|
|
3afd07451c | ||
|
|
27ee6e0f45 | ||
|
|
849934ccd6 | ||
|
|
597f0ae5fd | ||
|
|
2115046bbc | ||
|
|
565745f7b7 | ||
|
|
76b8afee94 | ||
|
|
892fcd6cc0 | ||
|
|
5537902796 | ||
|
|
9518d053a4 | ||
|
|
93c44157ba | ||
|
|
d47522e6fb | ||
|
|
3e233e4856 | ||
|
|
b908559ac8 | ||
|
|
4a7fdef3ea | ||
|
|
a0e9b21c9d | ||
|
|
0cfd801f09 | ||
|
|
c4f013a6f9 | ||
|
|
20c930e48e | ||
|
|
abe33f0ef4 | ||
|
|
3cfc83b23b | ||
|
|
e4c85b318f | ||
|
|
f524fe4934 | ||
|
|
fedbafc79b | ||
|
|
4dc48aea63 | ||
|
|
c8f2b3a722 | ||
|
|
e7b31af784 | ||
|
|
8fbd6d85e0 | ||
|
|
8d4afcb5b8 | ||
|
|
a166dd0ad7 | ||
|
|
5871291956 | ||
|
|
24ffc3610a | ||
|
|
85507dd042 | ||
|
|
4ada2e5664 | ||
|
|
0cf9ede580 | ||
|
|
975a183796 | ||
|
|
7671e3878c | ||
|
|
372e4d94c5 | ||
|
|
e9f94e698d | ||
|
|
9697290111 | ||
|
|
03babafc7b | ||
|
|
78b5d9ed45 | ||
|
|
ba93593711 | ||
|
|
a8695ecd32 | ||
|
|
98c719f714 | ||
|
|
b970d468d1 | ||
|
|
dda533cf67 | ||
|
|
aa04cc9b42 | ||
|
|
608d057066 | ||
|
|
04bcb74970 | ||
|
|
6e90aa7d65 | ||
|
|
2361a6fc79 | ||
|
|
7077272baa | ||
|
|
0b475dd654 | ||
|
|
1997dee3d9 | ||
|
|
e1c0646f95 | ||
|
|
c9f5614417 | ||
|
|
7875a12617 | ||
|
|
5afe11ba1c | ||
|
|
47b98bc90f | ||
|
|
b58433fb74 | ||
|
|
e228cf1cc4 | ||
|
|
3092483433 | ||
|
|
30d937f299 | ||
|
|
e8c2fc1585 | ||
|
|
2e391fa44c | ||
|
|
2f5008107c | ||
|
|
4cd54d2f87 | ||
|
|
87e8a12a9f | ||
|
|
ffde764a91 | ||
|
|
62d29d5106 | ||
|
|
5c132c98ca | ||
|
|
14bd9ebb45 | ||
|
|
2f9e287f7d | ||
|
|
8ac2fe6eb1 | ||
|
|
1c5ce723d8 | ||
|
|
a7d280cb3d | ||
|
|
111336459e | ||
|
|
cff3b7f9bd | ||
|
|
cfc19b4dde | ||
|
|
f52c0032a3 | ||
|
|
dfe0e9382d | ||
|
|
a699ddd14a | ||
|
|
ae4e85f11c | ||
|
|
e2af50b7c9 | ||
|
|
1758070cdc | ||
|
|
7881aaa759 | ||
|
|
ed160f2d2a | ||
|
|
802bcc9ba3 | ||
|
|
351a711ce9 | ||
|
|
0cf0bde158 | ||
|
|
dc7b4e7d32 | ||
|
|
9488af5a42 | ||
|
|
bd2b0c45ba | ||
|
|
8565053c93 | ||
|
|
5287b8cd9f | ||
|
|
0b22bc9b42 | ||
|
|
182f92ab26 | ||
|
|
55cea74b56 | ||
|
|
33df9d1bf2 | ||
|
|
37ed9116b7 | ||
|
|
3af8af5730 | ||
|
|
0db4dab03e | ||
|
|
df66fa7975 | ||
|
|
d2894b3c58 | ||
|
|
cd01aa4666 | ||
|
|
74ce263d69 | ||
|
|
ac9f9b653c | ||
|
|
c48cf2bba8 | ||
|
|
dcebab4c35 | ||
|
|
5345a89dc5 | ||
|
|
95b0549c75 | ||
|
|
04bcab8057 | ||
|
|
332f55e552 | ||
|
|
7f3f641fb8 | ||
|
|
18270e1059 | ||
|
|
645933a5da | ||
|
|
2a2e7bd190 | ||
|
|
2d38f51834 | ||
|
|
a3cc97128b | ||
|
|
71d3490bcd | ||
|
|
aa5e477236 | ||
|
|
3127a34298 | ||
|
|
0cb7376db0 | ||
|
|
e69a3a41f6 | ||
|
|
608c61dcd9 | ||
|
|
3dd2a0443d | ||
|
|
84434fddee | ||
|
|
784b671559 | ||
|
|
edfa15558b | ||
|
|
1481e9ae6a | ||
|
|
1d1927bb2b | ||
|
|
42c45df84d | ||
|
|
29f7a5bcfa | ||
|
|
5c5c13a28f | ||
|
|
cb2e87210c | ||
|
|
14081bed46 | ||
|
|
2826ca4362 | ||
|
|
f996313aab | ||
|
|
7127bcda97 | ||
|
|
3443ede52a | ||
|
|
4b93bb4082 | ||
|
|
2a9ae4b367 | ||
|
|
a8e77688f0 | ||
|
|
34e3c7b68f | ||
|
|
c8914bd4d4 | ||
|
|
1b2533f92d | ||
|
|
37d269c104 | ||
|
|
d697c37d3e | ||
|
|
4df5aadb01 | ||
|
|
058ef27178 | ||
|
|
ccb9eb28e1 | ||
|
|
d5a0384630 | ||
|
|
fa47067802 | ||
|
|
45fabf4b96 | ||
|
|
46e01db785 | ||
|
|
8da0abfa1a | ||
|
|
dd5a39731a | ||
|
|
b6aa868c28 | ||
|
|
724ff7e4fa | ||
|
|
1a64a29c84 | ||
|
|
2aa32c16dc | ||
|
|
0d6773c68c | ||
|
|
41876fd8c6 | ||
|
|
6f84ce72f2 | ||
|
|
824d54f131 | ||
|
|
07dd324e2f | ||
|
|
6d25fff3f9 | ||
|
|
9bfe04586d | ||
|
|
1ecb593c7b | ||
|
|
e46351cfbd | ||
|
|
58d63d55bc | ||
|
|
fed17cb58a | ||
|
|
35fc3b4dbb | ||
|
|
dba7a5a7e2 | ||
|
|
2fa180e9ea | ||
|
|
3b9fc987b8 | ||
|
|
e272ec13c3 | ||
|
|
b97b4439c0 | ||
|
|
3f98034c2a | ||
|
|
3d448f843e | ||
|
|
d8c923c385 | ||
|
|
3bf6c63d52 | ||
|
|
335bf7018d | ||
|
|
d8fb6d2a5a | ||
|
|
c243d09398 | ||
|
|
7fa4fdacc9 | ||
|
|
71195bb219 | ||
|
|
ec0b708b18 | ||
|
|
cfee830877 | ||
|
|
3dd2235ac5 | ||
|
|
cc2c54093e | ||
|
|
2dfcc0bb7b | ||
|
|
256c86f8f7 | ||
|
|
a276ebd240 | ||
|
|
1d0a5b2665 | ||
|
|
636e61d68b | ||
|
|
0bf60c8876 | ||
|
|
a94541d38c | ||
|
|
ce3b85a62e | ||
|
|
281aa5ebc4 | ||
|
|
84d9ff0c5c | ||
|
|
68a2954c67 | ||
|
|
c56acf0e32 | ||
|
|
2a17e5237c | ||
|
|
56406b3442 | ||
|
|
660e090315 | ||
|
|
d12eac8669 | ||
|
|
2dc556e082 | ||
|
|
75027f9557 | ||
|
|
e8dbecb4db | ||
|
|
317c5b693a | ||
|
|
a86af4477e | ||
|
|
59924b9223 | ||
|
|
c8110222a5 | ||
|
|
1143d4237f | ||
|
|
8d5108b142 | ||
|
|
03e18bb7ca | ||
|
|
6a96652396 | ||
|
|
d4bdd84364 | ||
|
|
b45b329861 | ||
|
|
28ee9788a0 | ||
|
|
596aceb185 | ||
|
|
1f3e53b32e | ||
|
|
13db806861 | ||
|
|
d0fdf0eb38 | ||
|
|
c5d787d6fd | ||
|
|
873d128c5a | ||
|
|
7f35ec7665 | ||
|
|
86cc274cf0 | ||
|
|
c19b2c5172 | ||
|
|
4906686186 | ||
|
|
f038ec3b6e | ||
|
|
a609f726e6 | ||
|
|
7bd47777a9 | ||
|
|
21cd47d223 | ||
|
|
882ea76aa9 | ||
|
|
850e1c7d40 | ||
|
|
01411e37d6 | ||
|
|
4922daf498 | ||
|
|
8fbb1e6d97 | ||
|
|
7fc8c7ccfd | ||
|
|
7eb272b299 | ||
|
|
8bfa909ff2 | ||
|
|
3b085ed20f | ||
|
|
8b640979ee | ||
|
|
c58ddff3a4 | ||
|
|
5f16a8a6b1 | ||
|
|
53a53668d9 | ||
|
|
e7d8982583 | ||
|
|
abc5e27931 | ||
|
|
c75eaec852 | ||
|
|
d9a349c1a1 | ||
|
|
9d143ed653 | ||
|
|
ce4927e5d3 | ||
|
|
17c551539b | ||
|
|
2f55393593 | ||
|
|
d26f3333e4 | ||
|
|
820e2c73e6 | ||
|
|
efbbb84315 | ||
|
|
96e7a60b8d | ||
|
|
c22b71fc5b | ||
|
|
007963afde | ||
|
|
0708736c45 | ||
|
|
61d50d531c | ||
|
|
a17110b32a | ||
|
|
571d808d25 | ||
|
|
5e6ecdad9f | - | |
|
|
91e75f7215 | ||
|
|
81d599786a | ||
|
|
9471b0ab88 | ||
|
|
470af42bf2 | ||
|
|
0b34812afc | ||
|
|
47a36de74e | ||
|
|
0c21aa5530 | ||
|
|
fe109b27be | ||
|
|
3f873dc222 | ||
|
|
e0ae2b4155 | ||
|
|
5f603ae787 | ||
|
|
d4502aff87 | ||
|
|
3992ed6ad1 | ||
|
|
b72eb53a73 | ||
|
|
4d0c6cefd0 | ||
|
|
3f8f1dc00c | ||
|
|
008c77c911 | ||
|
|
77b37687b6 | ||
|
|
b7307298d2 | ||
|
|
abcf81e2a8 | ||
|
|
e477fce211 | ||
|
|
467766cfe8 | ||
|
|
66391e5c9d | ||
|
|
f7024a6000 | ||
|
|
ec33ce9d29 | ||
|
|
d0aa0175e6 | ||
|
|
d9e5717377 | ||
|
|
7e255177dc | ||
|
|
b0a0b509da | ||
|
|
8c737069a5 | ||
|
|
51038497f6 | ||
|
|
855c273707 | ||
|
|
281ab5a8f9 | ||
|
|
7836536459 | ||
|
|
2a0eff9c71 | ||
|
|
3e8a14e133 | ||
|
|
8ef0e88220 | ||
|
|
e102c1b4ca | ||
|
|
5ba43d0fe5 | ||
|
|
783e540d6d | ||
|
|
24da41005c | ||
|
|
17d3e1d498 | ||
|
|
8d2ab68a97 | ||
|
|
7322aa5b64 | ||
|
|
6b11cf21f3 | ||
|
|
9322d13f61 | ||
|
|
86a06c5c18 | ||
|
|
d0cb56932c | ||
|
|
fc04d8a368 | ||
|
|
519b9cee96 | ||
|
|
efba606e57 | ||
|
|
5bb18810d4 | ||
|
|
853383a8d3 | ||
|
|
f319006813 | ||
|
|
2fa021582b | ||
|
|
0ed641a26e | ||
|
|
aad27218d5 | ||
|
|
c2fd568695 | ||
|
|
8f72c48548 | ||
|
|
08a821381a | ||
|
|
4625445d2a | ||
|
|
ca428504d4 | ||
|
|
88f79b74ce | ||
|
|
647cdd3847 | ||
|
|
c510d21e4e | ||
|
|
430e87d0fd | ||
|
|
49e5df1ff9 | ||
|
|
2357b13824 | ||
|
|
f137db6803 | ||
|
|
2cf0dad573 | ||
|
|
414b9dde84 | ||
|
|
d50742f059 | ||
|
|
3bc9a181a1 | ||
|
|
975720a30c | ||
|
|
1361506ae6 | ||
|
|
23ff27ea4b | ||
|
|
933cbd735b | ||
|
|
ce1945c780 | ||
|
|
f52a413b6a | ||
|
|
ced96912f3 | ||
|
|
f6e97c322b | ||
|
|
c9d61aefe4 | ||
|
|
85c79658ef | ||
|
|
c4c86fd6e8 | ||
|
|
95dcdd8a05 | ||
|
|
43669183ce | ||
|
|
56e58fdcaf | ||
|
|
47378164ef | ||
|
|
9469b4bb69 | ||
|
|
6cead64345 | ||
|
|
773630b010 | ||
|
|
907e529471 | ||
|
|
2d70647f72 | ||
|
|
10cc4673f9 | ||
|
|
629d730da6 | ||
|
|
d4eabaaacc | ||
|
|
5693314a37 | ||
|
|
2e4724ccea | ||
|
|
e7084940e1 | ||
|
|
b141da36a4 | ||
|
|
bb16fe8115 | ||
|
|
a987729712 | ||
|
|
f7cc7b1778 | ||
|
|
e1909375f5 | ||
|
|
cf94c96a68 | ||
|
|
e7e395549f | ||
|
|
e776242de1 | ||
|
|
7b79cea738 | ||
|
|
32a861b2ed | ||
|
|
2ce26d4a1c | ||
|
|
aa0f78b740 | ||
|
|
e4adef5226 | ||
|
|
7dc581fad9 | ||
|
|
0b6dc091f5 | ||
|
|
e1714e678e | ||
|
|
d10b08ff88 | ||
|
|
18c42e88f5 | ||
|
|
f238dffc18 | ||
|
|
5a7ec361f4 | ||
|
|
291d4742d6 | ||
|
|
95ba6fcab2 | ||
|
|
1cdd1d04ce | ||
|
|
3293c0e8f4 | ||
|
|
074150ff2c | ||
|
|
c3c90bb09c | ||
|
|
87560d65ca | ||
|
|
7e4f7fa600 | ||
|
|
7f9c6233bb | ||
|
|
9b6a190652 | ||
|
|
1e1fb1e7a8 | ||
|
|
080db5ee5d | ||
|
|
2edda29448 | ||
|
|
6ba3523a26 | ||
|
|
87e7a04209 | ||
|
|
260e32a7c3 | ||
|
|
5fff2c757b | ||
|
|
30d699b64f | ||
|
|
7d91d3fb5c | ||
|
|
747f882b0e | ||
|
|
369e7cb38f | ||
|
|
04c456b877 | ||
|
|
f408829d51 | ||
|
|
73b414ab45 | ||
|
|
f18c40fd36 | ||
|
|
891e52d723 | ||
|
|
d2ff0f40eb | ||
|
|
787110c853 | ||
|
|
20319044a3 | ||
|
|
6f08c81698 | ||
|
|
868cd3d1cb | ||
|
|
39edf7a7fa | ||
|
|
4cf4362610 | ||
|
|
0b719f037c | ||
|
|
9603589b06 | ||
|
|
5f38c1209e | ||
|
|
749edb3554 | ||
|
|
882b465968 | ||
|
|
784fe8bbdb | ||
|
|
6253cf4c18 | ||
|
|
8521075868 | ||
|
|
2d98ca7477 | ||
|
|
e2d6a92150 | ||
|
|
162b751f6d | ||
|
|
20aed5488b | ||
|
|
2374d0fd7a | ||
|
|
483d00736c | ||
|
|
15de7d9dba | ||
|
|
34a583b821 | ||
|
|
2da86daa3a | ||
|
|
b4eac4c993 | ||
|
|
b4a4f38cce | ||
|
|
8c81cf64de | ||
|
|
00f066a467 | ||
|
|
bdf9f90c8a | ||
|
|
428678b2e4 | ||
|
|
bcd30f05ab | ||
|
|
bd49da067f | ||
|
|
3e7c682e66 | ||
|
|
bbd1e40bd5 | ||
|
|
a25f5ff1dd | ||
|
|
80d860d2d4 | ||
|
|
f31ade335d | ||
|
|
023ab755e5 | ||
|
|
4320f81bf4 | ||
|
|
47f1f28385 | ||
|
|
3d1444b829 | ||
|
|
4d3a9defd2 | ||
|
|
1f1211747b | ||
|
|
45e30048f0 | ||
|
|
245c6edec3 | ||
|
|
cb0a96fbf3 | ||
|
|
fade9e36b6 | ||
|
|
24e2a05605 | ||
|
|
1749260c97 | ||
|
|
3b86c3c0e3 | ||
|
|
8f3da7b72c | ||
|
|
d6cde6a5df | ||
|
|
54fd24b757 | ||
|
|
2153b21152 | ||
|
|
74013d751c | ||
|
|
1fa1cdd2a3 | ||
|
|
cd0d0a2b17 | ||
|
|
e63569041a | ||
|
|
54449483b6 | ||
|
|
52bedf4c0b | ||
|
|
5962c0ea86 | ||
|
|
9b2d7382bf | ||
|
|
d91af4cadf | ||
|
|
7e3d265b0f | ||
|
|
f990a7b453 | ||
|
|
ef02d02b1f | ||
|
|
04c169ecfe | ||
|
|
5593f12347 | ||
|
|
3189d8690e | ||
|
|
b51e042e73 | ||
|
|
82f1320ed5 | ||
|
|
add6feab02 | ||
|
|
670c4aecdd | ||
|
|
215d3984cc | ||
|
|
0b36d925f6 | ||
|
|
bc290f62d7 | ||
|
|
c0faa9e79c | ||
|
|
f887906ec3 | ||
|
|
982fd9d803 | ||
|
|
d64bf501d0 | ||
|
|
49f1ec1efb | ||
|
|
0741448798 | ||
|
|
8a4d5c4683 | ||
|
|
3cdb777c23 | ||
|
|
ddc5452978 | ||
|
|
8aa6fabd4d | ||
|
|
398f5b501f | ||
|
|
8d9bcefa9d | ||
|
|
0b29964bf8 | ||
|
|
06e662be86 | ||
|
|
e153b94190 | ||
|
|
7d0374df2f | ||
|
|
2f60748c73 | ||
|
|
bbd58b922b | ||
|
|
21e51b504e | ||
|
|
ba79a2eb97 | ||
|
|
ef81c16611 | ||
|
|
da26f1f377 | ||
|
|
c8cc2d0421 | ||
|
|
a00dc1abf3 | ||
|
|
59c747b793 | ||
|
|
baddc5b6ad | ||
|
|
637d0330c2 | ||
|
|
21e2d0c34a | ||
|
|
ec5f227381 | ||
|
|
8ffb2462f9 | ||
|
|
12187155b4 | ||
|
|
d7f49f3aa5 | ||
|
|
461497f5be | ||
|
|
7929bb91be | ||
|
|
6e13e7343d | ||
|
|
f9f3b46ef6 | ||
|
|
cc851818c2 | ||
|
|
ba45b9d890 | ||
|
|
9fd70c209b | ||
|
|
b7970c2a46 | ||
|
|
a7d072a7c0 | ||
|
|
054891ab5e | ||
|
|
d18ea48b95 | ||
|
|
d39cde206b | ||
|
|
58d5e0318e | ||
|
|
3e23e48239 | ||
|
|
f1f5788066 | ||
|
|
928facfcd9 | ||
|
|
70857f3097 | ||
|
|
da726fc030 | ||
|
|
874a874ea6 | ||
|
|
0f76e17258 | ||
|
|
6b36911260 | ||
|
|
1ebf3afb24 | ||
|
|
84544b1d01 | ||
|
|
319b570f82 | ||
|
|
f7481adf45 | ||
|
|
9b165629f9 | ||
|
|
79b43b2b6e | ||
|
|
80b71a03ce | ||
|
|
2546bafdde | ||
|
|
d27e4bff1e | ||
|
|
27dd96cf3d | ||
|
|
3e45e4ba51 | ||
|
|
0ee249247a | ||
|
|
0f520a8c69 | ||
|
|
aa33194606 | ||
|
|
51360e1ede | ||
|
|
af0febe8ad | ||
|
|
155863bf71 | ||
|
|
3cec61481c | ||
|
|
5708fe9565 | ||
|
|
c40deefb8a | ||
|
|
cd8ce63a3b | ||
|
|
35beda21b8 | ||
|
|
85b8b2bd44 | ||
|
|
29aa7736ca | ||
|
|
e8ff405fce | ||
|
|
5172d24e66 | ||
|
|
dfe7d877eb | ||
|
|
0c00a17372 | ||
|
|
fa1db95814 | ||
|
|
d77c0ec138 | ||
|
|
8ba12ff4f3 | ||
|
|
14ef462263 | ||
|
|
1421ffa32a | ||
|
|
62931b60f8 | ||
|
|
b1e28c7fd8 | ||
|
|
9b0bb871d2 | ||
|
|
1971bdbe67 | ||
|
|
912f48eece | ||
|
|
86fb0cb235 | ||
|
|
23ee58d6ec | ||
|
|
9e0dcae0aa | ||
|
|
7215452da5 | ||
|
|
01b22a7e12 | ||
|
|
d28804cc48 | ||
|
|
a046a04aa2 | ||
|
|
59dd3ed459 | ||
|
|
b6f6048cff | ||
|
|
8a4a05aac0 | ||
|
|
64d6c3074f | ||
|
|
45ca6d8a78 | ||
|
|
77f4b8a75e | ||
|
|
122c4f0514 | ||
|
|
83494152fe | ||
|
|
f6f636f74c | ||
|
|
39e9424f01 | ||
|
|
d93731213a | ||
|
|
f31dc8a9ef | ||
|
|
4687951a04 | ||
|
|
576cba81d9 | ||
|
|
d3a46c822f | ||
|
|
ea86602765 | ||
|
|
fec0d1a9a0 | ||
|
|
642c667566 | ||
|
|
b8b87d416e | ||
|
|
6e14d4704d | ||
|
|
f494cd9c72 | ||
|
|
2814664e91 | ||
|
|
1359094cc8 | ||
|
|
7a62b10ff2 | ||
|
|
23d5761bd4 | ||
|
|
cc16073c36 | ||
|
|
ed8ff63048 | ||
|
|
267a852ba6 | ||
|
|
f2b04f94ca | ||
|
|
e350bea167 | ||
|
|
2401f14975 | ||
|
|
be228043a1 | ||
|
|
48ffb627fe | ||
|
|
89192c64f0 | ||
|
|
a67cc5c5a9 | ||
|
|
fa2f1c5f60 | ||
|
|
1d021c5cc1 | ||
|
|
e17111a5dd | ||
|
|
9fdee250de | ||
|
|
c6acfef3d0 | ||
|
|
e4c690e7bc | ||
|
|
ee43ad2497 | ||
|
|
044252ea7b | ||
|
|
f8032e08ae | ||
|
|
f0d2ac3dd5 | ||
|
|
270898e521 | ||
|
|
897dd3aaa8 | ||
|
|
dd01f8661e | ||
|
|
99c3970fd3 | ||
|
|
839c8cf150 | ||
|
|
b252cd8403 | ||
|
|
b3b2b19212 | ||
|
|
a74e954788 | ||
|
|
32f75585ad | ||
|
|
9a8b25d5fa | ||
|
|
14ba99f975 | ||
|
|
ccb7fdd8c2 | ||
|
|
9a1d90d184 | ||
|
|
22798ca32b | ||
|
|
3fe4753d5d | ||
|
|
d91157c567 | ||
|
|
e7b8e9371a | ||
|
|
1f60e1004c | ||
|
|
9e45d201f3 | ||
|
|
47ecb3662d | ||
|
|
7369e47f18 | ||
|
|
6f5b64bca6 | ||
|
|
e788ca7ee6 | ||
|
|
68dea921e7 | ||
|
|
f96157d259 | ||
|
|
718f45698d | ||
|
|
15761fc126 | ||
|
|
edfdef2396 | ||
|
|
a9e18e9106 | ||
|
|
3b82b06adc | ||
|
|
d1c89333d0 | ||
|
|
e26570d0d8 | ||
|
|
8b3c4da2c7 | ||
|
|
5c4aa1f4b7 | ||
|
|
d2cdefa7df | ||
|
|
720d0b2c38 | ||
|
|
d2584ff853 | ||
|
|
433452f9f1 | ||
|
|
a34e0bea8b | ||
|
|
f66b35454f | ||
|
|
b5c2806e8c | ||
|
|
5072399f7a | ||
|
|
736cb70e9a | ||
|
|
8eafb8d3df | ||
|
|
e8234a0137 | ||
|
|
fbe0393eb3 | ||
|
|
b82e72eb04 | ||
|
|
a7c87edebe | ||
|
|
7e20f32b02 | ||
|
|
4419e7183f | ||
|
|
6bde955170 | ||
|
|
952970f403 | ||
|
|
d3911da653 | ||
|
|
7b6ed48a86 | ||
|
|
7229dbe033 | ||
|
|
015d6b78d5 | ||
|
|
f4c4bf3d0b | ||
|
|
efedbd9775 | ||
|
|
f4e03a5d32 | ||
|
|
34ca692c9c | ||
|
|
a5517960ea | ||
|
|
fa42c12e5b | ||
|
|
8ac29b40e9 | ||
|
|
adb53c2b4f |
2
.coveragerc
Normal file
2
.coveragerc
Normal file
@@ -0,0 +1,2 @@
|
||||
[run]
|
||||
omit = requests/packages/*
|
||||
28
.github/ISSUE_TEMPLATE.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
Summary.
|
||||
|
||||
## Expected Result
|
||||
|
||||
What you expected.
|
||||
|
||||
## Actual Result
|
||||
|
||||
What happened instead.
|
||||
|
||||
## Reproduction Steps
|
||||
|
||||
```python
|
||||
import requests
|
||||
|
||||
```
|
||||
|
||||
## System Information
|
||||
|
||||
$ python -m requests.help
|
||||
|
||||
```
|
||||
<paste here>
|
||||
```
|
||||
|
||||
This command is only available on Requests v2.16.4 and greater. Otherwise,
|
||||
please provide some basic information about your system (Python version,
|
||||
operating system, &c).
|
||||
25
.gitignore
vendored
25
.gitignore
vendored
@@ -1,2 +1,23 @@
|
||||
.idea
|
||||
MANIFEST
|
||||
.coverage
|
||||
MANIFEST
|
||||
coverage.xml
|
||||
nosetests.xml
|
||||
junit-report.xml
|
||||
pylint.txt
|
||||
toy.py
|
||||
.cache/
|
||||
cover/
|
||||
build/
|
||||
docs/_build
|
||||
requests.egg-info/
|
||||
*.pyc
|
||||
*.swp
|
||||
*.egg
|
||||
env/
|
||||
|
||||
.workon
|
||||
|
||||
t.py
|
||||
|
||||
t2.py
|
||||
dist
|
||||
|
||||
31
.travis.yml
Normal file
31
.travis.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
sudo: false
|
||||
language: python
|
||||
python:
|
||||
- "2.6"
|
||||
- "2.7"
|
||||
- "3.4"
|
||||
- "3.5"
|
||||
- "3.6"
|
||||
# - "3.7-dev"
|
||||
# - "pypy" -- appears to hang
|
||||
# - "pypy3"
|
||||
# command to install dependencies
|
||||
install: "make"
|
||||
# command to run tests
|
||||
script:
|
||||
- |
|
||||
if [[ "$TRAVIS_PYTHON_VERSION" != "2.6" ]] ; then make test-readme; fi
|
||||
- make ci
|
||||
cache: pip
|
||||
jobs:
|
||||
include:
|
||||
- stage: test
|
||||
script:
|
||||
- |
|
||||
if [[ "$TRAVIS_PYTHON_VERSION" != "2.6" ]] ; then make test-readme; fi
|
||||
- make ci
|
||||
- stage: coverage
|
||||
python: 3.6
|
||||
script: codecov
|
||||
|
||||
|
||||
14
AUTHORS
14
AUTHORS
@@ -1,14 +0,0 @@
|
||||
Requests is written and maintained by Kenneth Reitz and
|
||||
various contributors:
|
||||
|
||||
Development Lead
|
||||
````````````````
|
||||
|
||||
- Kenneth Reitz <me@kennethreitz.com>
|
||||
|
||||
|
||||
Patches and Suggestions
|
||||
```````````````````````
|
||||
|
||||
- Various Pocoo Members
|
||||
- Chris Adams
|
||||
180
AUTHORS.rst
Normal file
180
AUTHORS.rst
Normal file
@@ -0,0 +1,180 @@
|
||||
Requests is written and maintained by Kenneth Reitz and
|
||||
various contributors:
|
||||
|
||||
Keepers of the Four Crystals
|
||||
````````````````````````````
|
||||
|
||||
- Kenneth Reitz <me@kennethreitz.org> `@kennethreitz <https://github.com/kennethreitz>`_, Keeper of the Master Crystal.
|
||||
- Cory Benfield <cory@lukasa.co.uk> `@lukasa <https://github.com/lukasa>`_
|
||||
- Ian Cordasco <graffatcolmingov@gmail.com> `@sigmavirus24 <https://github.com/sigmavirus24>`_
|
||||
- Nate Prewitt <nate.prewitt@gmail.com> `@nateprewitt <https://github.com/nateprewitt>`_
|
||||
|
||||
|
||||
Patches and Suggestions
|
||||
```````````````````````
|
||||
|
||||
- Various Pocoo Members
|
||||
- Chris Adams
|
||||
- Flavio Percoco Premoli
|
||||
- Dj Gilcrease
|
||||
- Justin Murphy
|
||||
- Rob Madole
|
||||
- Aram Dulyan
|
||||
- Johannes Gorset
|
||||
- 村山めがね (Megane Murayama)
|
||||
- James Rowe
|
||||
- Daniel Schauenberg
|
||||
- Zbigniew Siciarz
|
||||
- Daniele Tricoli 'Eriol'
|
||||
- Richard Boulton
|
||||
- Miguel Olivares <miguel@moliware.com>
|
||||
- Alberto Paro
|
||||
- Jérémy Bethmont
|
||||
- 潘旭 (Xu Pan)
|
||||
- Tamás Gulácsi
|
||||
- Rubén Abad
|
||||
- Peter Manser
|
||||
- Jeremy Selier
|
||||
- Jens Diemer
|
||||
- Alex (`@alopatin <https://github.com/alopatin>`_)
|
||||
- Tom Hogans <tomhsx@gmail.com>
|
||||
- Armin Ronacher
|
||||
- Shrikant Sharat Kandula
|
||||
- Mikko Ohtamaa
|
||||
- Den Shabalin
|
||||
- Daniel Miller <danielm@vs-networks.com>
|
||||
- Alejandro Giacometti
|
||||
- Rick Mak
|
||||
- Johan Bergström
|
||||
- Josselin Jacquard
|
||||
- Travis N. Vaught
|
||||
- Fredrik Möllerstrand
|
||||
- Daniel Hengeveld
|
||||
- Dan Head
|
||||
- Bruno Renié
|
||||
- David Fischer
|
||||
- Joseph McCullough
|
||||
- Juergen Brendel
|
||||
- Juan Riaza
|
||||
- Ryan Kelly
|
||||
- Rolando Espinoza La fuente
|
||||
- Robert Gieseke
|
||||
- Idan Gazit
|
||||
- Ed Summers
|
||||
- Chris Van Horne
|
||||
- Christopher Davis
|
||||
- Ori Livneh
|
||||
- Jason Emerick
|
||||
- Bryan Helmig
|
||||
- Jonas Obrist
|
||||
- Lucian Ursu
|
||||
- Tom Moertel
|
||||
- Frank Kumro Jr
|
||||
- Chase Sterling
|
||||
- Marty Alchin
|
||||
- takluyver
|
||||
- Ben Toews (`@mastahyeti <https://github.com/mastahyeti>`_)
|
||||
- David Kemp
|
||||
- Brendon Crawford
|
||||
- Denis (`@Telofy <https://github.com/Telofy>`_)
|
||||
- Matt Giuca
|
||||
- Adam Tauber
|
||||
- Honza Javorek
|
||||
- Brendan Maguire <maguire.brendan@gmail.com>
|
||||
- Chris Dary
|
||||
- Danver Braganza <danverbraganza@gmail.com>
|
||||
- Max Countryman
|
||||
- Nick Chadwick
|
||||
- Jonathan Drosdeck
|
||||
- Jiri Machalek
|
||||
- Steve Pulec
|
||||
- Michael Kelly
|
||||
- Michael Newman <newmaniese@gmail.com>
|
||||
- Jonty Wareing <jonty@jonty.co.uk>
|
||||
- Shivaram Lingamneni
|
||||
- Miguel Turner
|
||||
- Rohan Jain (`@crodjer <https://github.com/crodjer>`_)
|
||||
- Justin Barber <barber.justin@gmail.com>
|
||||
- Roman Haritonov (`@reclosedev <https://github.com/reclosedev>`_)
|
||||
- Josh Imhoff <joshimhoff13@gmail.com>
|
||||
- Arup Malakar <amalakar@gmail.com>
|
||||
- Danilo Bargen (`@dbrgn <https://github.com/dbrgn>`_)
|
||||
- Torsten Landschoff
|
||||
- Michael Holler (`@apotheos <https://github.com/apotheos>`_)
|
||||
- Timnit Gebru
|
||||
- Sarah Gonzalez
|
||||
- Victoria Mo
|
||||
- Leila Muhtasib
|
||||
- Matthias Rahlf <matthias@webding.de>
|
||||
- Jakub Roztocil <jakub@roztocil.name>
|
||||
- Rhys Elsmore
|
||||
- André Graf (`@dergraf <https://github.com/dergraf>`_)
|
||||
- Stephen Zhuang (`@everbird <https://github.com/everbird>`_)
|
||||
- Martijn Pieters
|
||||
- Jonatan Heyman
|
||||
- David Bonner <dbonner@gmail.com> (`@rascalking <https://github.com/rascalking>`_)
|
||||
- Vinod Chandru
|
||||
- Johnny Goodnow <j.goodnow29@gmail.com>
|
||||
- Denis Ryzhkov <denisr@denisr.com>
|
||||
- Wilfred Hughes <me@wilfred.me.uk>
|
||||
- Dmitry Medvinsky <me@dmedvinsky.name>
|
||||
- Bryce Boe <bbzbryce@gmail.com> (`@bboe <https://github.com/bboe>`_)
|
||||
- Colin Dunklau <colin.dunklau@gmail.com> (`@cdunklau <https://github.com/cdunklau>`_)
|
||||
- Bob Carroll <bob.carroll@alum.rit.edu> (`@rcarz <https://github.com/rcarz>`_)
|
||||
- Hugo Osvaldo Barrera <hugo@osvaldobarrera.com.ar> (`@hobarrera <https://github.com/hobarrera>`_)
|
||||
- Łukasz Langa <lukasz@langa.pl>
|
||||
- Dave Shawley <daveshawley@gmail.com>
|
||||
- James Clarke (`@jam <https://github.com/jam>`_)
|
||||
- Kevin Burke <kev@inburke.com>
|
||||
- Flavio Curella
|
||||
- David Pursehouse <david.pursehouse@gmail.com> (`@dpursehouse <https://github.com/dpursehouse>`_)
|
||||
- Jon Parise (`@jparise <https://github.com/jparise>`_)
|
||||
- Alexander Karpinsky (`@homm86 <https://twitter.com/homm86>`_)
|
||||
- Marc Schlaich (`@schlamar <https://github.com/schlamar>`_)
|
||||
- Park Ilsu <daftonshady@gmail.com> (`@daftshady <https://github.com/daftshady>`_)
|
||||
- Matt Spitz (`@mattspitz <https://github.com/mattspitz>`_)
|
||||
- Vikram Oberoi (`@voberoi <https://github.com/voberoi>`_)
|
||||
- Can Ibanoglu <can.ibanoglu@gmail.com> (`@canibanoglu <https://github.com/canibanoglu>`_)
|
||||
- Thomas Weißschuh <thomas@t-8ch.de> (`@t-8ch <https://github.com/t-8ch>`_)
|
||||
- Jayson Vantuyl <jayson@aggressive.ly>
|
||||
- Pengfei.X <pengphy@gmail.com>
|
||||
- Kamil Madac <kamil.madac@gmail.com>
|
||||
- Michael Becker <mike@beckerfuffle.com> (`@beckerfuffle <https://twitter.com/beckerfuffle>`_)
|
||||
- Erik Wickstrom <erik@erikwickstrom.com> (`@erikwickstrom <https://github.com/erikwickstrom>`_)
|
||||
- Константин Подшумок (`@podshumok <https://github.com/podshumok>`_)
|
||||
- Ben Bass (`@codedstructure <https://github.com/codedstructure>`_)
|
||||
- Jonathan Wong <evolutionace@gmail.com> (`@ContinuousFunction <https://github.com/ContinuousFunction>`_)
|
||||
- Martin Jul (`@mjul <https://github.com/mjul>`_)
|
||||
- Joe Alcorn (`@buttscicles <https://github.com/buttscicles>`_)
|
||||
- Syed Suhail Ahmed <ssuhail.ahmed93@gmail.com> (`@syedsuhail <https://github.com/syedsuhail>`_)
|
||||
- Scott Sadler (`@ssadler <https://github.com/ssadler>`_)
|
||||
- Arthur Darcet (`@arthurdarcet <https://github.com/arthurdarcet>`_)
|
||||
- Ulrich Petri (`@ulope <https://github.com/ulope>`_)
|
||||
- Muhammad Yasoob Ullah Khalid <yasoob.khld@gmail.com> (`@yasoob <https://github.com/yasoob>`_)
|
||||
- Paul van der Linden (`@pvanderlinden <https://github.com/pvanderlinden>`_)
|
||||
- Colin Dickson (`@colindickson <https://github.com/colindickson>`_)
|
||||
- Smiley Barry (`@smiley <https://github.com/smiley>`_)
|
||||
- Shagun Sodhani (`@shagunsodhani <https://github.com/shagunsodhani>`_)
|
||||
- Robin Linderborg (`@vienno <https://github.com/vienno>`_)
|
||||
- Brian Samek (`@bsamek <https://github.com/bsamek>`_)
|
||||
- Dmitry Dygalo (`@Stranger6667 <https://github.com/Stranger6667>`_)
|
||||
- piotrjurkiewicz
|
||||
- Jesse Shapiro <jesse@jesseshapiro.net> (`@haikuginger <https://github.com/haikuginger>`_)
|
||||
- Nate Prewitt <nate.prewitt@gmail.com> (`@nateprewitt <https://github.com/nateprewitt>`_)
|
||||
- Maik Himstedt
|
||||
- Michael Hunsinger
|
||||
- Brian Bamsch <bbamsch32@gmail.com> (`@bbamsch <https://github.com/bbamsch>`_)
|
||||
- Om Prakash Kumar <omprakash070@gmail.com> (`@iamprakashom <https://github.com/iamprakashom>`_)
|
||||
- Philipp Konrad <gardiac2002@gmail.com> (`@gardiac2002 <https://github.com/gardiac2002>`_)
|
||||
- Hussain Tamboli <hussaintamboli18@gmail.com> (`@hussaintamboli <https://github.com/hussaintamboli>`_)
|
||||
- Casey Davidson (`@davidsoncasey <https://github.com/davidsoncasey>`_)
|
||||
- Andrii Soldatenko (`@a_soldatenko <https://github.com/andriisoldatenko>`_)
|
||||
- Moinuddin Quadri <moin18@gmail.com> (`@moin18 <https://github.com/moin18>`_)
|
||||
- Matt Kohl (`@mattkohl <https://github.com/mattkohl>`_)
|
||||
- Jonathan Vanasco (`@jvanasco <https://github.com/jvanasco>`_)
|
||||
- David Fontenot (`@davidfontenot <https://github.com/davidfontenot>`_)
|
||||
- Shmuel Amar (`@shmuelamar <https://github.com/shmuelamar>`_)
|
||||
- Gary Wu (`@garywu <https://github.com/garywu>`_)
|
||||
- Ryan Pineo (`@ryanpineo <https://github.com/ryanpineo>`_)
|
||||
- Ed Morley (`@edmorley <https://github.com/edmorley>`_)
|
||||
- Matt Liu <liumatt@gmail.com> (`@mlcrazy <https://github.com/mlcrazy>`_)
|
||||
3
CODE_OF_CONDUCT.md
Normal file
3
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Be cordial or be on your way.
|
||||
|
||||
https://www.kennethreitz.org/essays/be-cordial-or-be-on-your-way
|
||||
57
CONTRIBUTING.md
Normal file
57
CONTRIBUTING.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# Contribution Guidelines
|
||||
|
||||
Before opening any issues or proposing any pull requests, please do the
|
||||
following:
|
||||
|
||||
1. Read our [Contributor's Guide](http://docs.python-requests.org/en/latest/dev/contributing/).
|
||||
2. Understand our [development philosophy](http://docs.python-requests.org/en/latest/dev/philosophy/).
|
||||
|
||||
To get the greatest chance of helpful responses, please also observe the
|
||||
following additional notes.
|
||||
|
||||
## Questions
|
||||
|
||||
The GitHub issue tracker is for *bug reports* and *feature requests*. Please do
|
||||
not use it to ask questions about how to use Requests. These questions should
|
||||
instead be directed to [Stack Overflow](https://stackoverflow.com/). Make sure
|
||||
that your question is tagged with the `python-requests` tag when asking it on
|
||||
Stack Overflow, to ensure that it is answered promptly and accurately.
|
||||
|
||||
## Good Bug Reports
|
||||
|
||||
Please be aware of the following things when filing bug reports:
|
||||
|
||||
1. Avoid raising duplicate issues. *Please* use the GitHub issue search feature
|
||||
to check whether your bug report or feature request has been mentioned in
|
||||
the past. Duplicate bug reports and feature requests are a huge maintenance
|
||||
burden on the limited resources of the project. If it is clear from your
|
||||
report that you would have struggled to find the original, that's ok, but
|
||||
if searching for a selection of words in your issue title would have found
|
||||
the duplicate then the issue will likely be closed extremely abruptly.
|
||||
2. When filing bug reports about exceptions or tracebacks, please include the
|
||||
*complete* traceback. Partial tracebacks, or just the exception text, are
|
||||
not helpful. Issues that do not contain complete tracebacks may be closed
|
||||
without warning.
|
||||
3. Make sure you provide a suitable amount of information to work with. This
|
||||
means you should provide:
|
||||
|
||||
- Guidance on **how to reproduce the issue**. Ideally, this should be a
|
||||
*small* code sample that can be run immediately by the maintainers.
|
||||
Failing that, let us know what you're doing, how often it happens, what
|
||||
environment you're using, etc. Be thorough: it prevents us needing to ask
|
||||
further questions.
|
||||
- Tell us **what you expected to happen**. When we run your example code,
|
||||
what are we expecting to happen? What does "success" look like for your
|
||||
code?
|
||||
- Tell us **what actually happens**. It's not helpful for you to say "it
|
||||
doesn't work" or "it fails". Tell us *how* it fails: do you get an
|
||||
exception? A hang? A non-200 status code? How was the actual result
|
||||
different from your expected result?
|
||||
- Tell us **what version of Requests you're using**, and
|
||||
**how you installed it**. Different versions of Requests behave
|
||||
differently and have different bugs, and some distributors of Requests
|
||||
ship patches on top of the code we supply.
|
||||
|
||||
If you do not provide all of these things, it will take us much longer to
|
||||
fix your problem. If we ask you to clarify these and you never respond, we
|
||||
will close your issue without fixing it.
|
||||
1501
HISTORY.rst
1501
HISTORY.rst
File diff suppressed because it is too large
Load Diff
22
LICENSE
22
LICENSE
@@ -1,13 +1,13 @@
|
||||
Copyright (c) 2011 Kenneth Reitz.
|
||||
Copyright 2017 Kenneth Reitz
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
include README.rst LICENSE HISTORY.rst
|
||||
include README.rst LICENSE NOTICE HISTORY.rst pytest.ini requirements.txt
|
||||
recursive-include tests *.py
|
||||
|
||||
27
Makefile
Normal file
27
Makefile
Normal file
@@ -0,0 +1,27 @@
|
||||
.PHONY: docs
|
||||
init:
|
||||
pip install -r requirements.txt
|
||||
test:
|
||||
# This runs all of the tests, on both Python 2 and Python 3.
|
||||
detox
|
||||
ci:
|
||||
py.test -n 8 --boxed --junitxml=report.xml
|
||||
|
||||
test-readme:
|
||||
@python setup.py check --restructuredtext --strict && ([ $$? -eq 0 ] && echo "README.rst and HISTORY.rst ok") || echo "Invalid markup in README.rst or HISTORY.rst!"
|
||||
|
||||
flake8:
|
||||
flake8 --ignore=E501,F401,E128,E402,E731,F821 requests
|
||||
|
||||
coverage:
|
||||
py.test --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=requests tests
|
||||
|
||||
publish:
|
||||
pip install 'twine>=1.5.0'
|
||||
python setup.py sdist bdist_wheel
|
||||
twine upload dist/*
|
||||
rm -fr build dist .egg requests.egg-info
|
||||
|
||||
docs:
|
||||
cd docs && make html
|
||||
@echo "\033[95m\n\nBuild successful! View the docs homepage at docs/_build/html/index.html.\n\033[0m"
|
||||
12
NOTICE
12
NOTICE
@@ -1,12 +0,0 @@
|
||||
Request includes some vendorized python libraries to ease installation.
|
||||
|
||||
Poster License
|
||||
==============
|
||||
|
||||
Copyright (c) 2010 Chris AtLee
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
188
README.rst
188
README.rst
@@ -1,138 +1,114 @@
|
||||
Requests: The Simple (e.g. usable) HTTP Module
|
||||
==============================================
|
||||
Requests: HTTP for Humans
|
||||
=========================
|
||||
|
||||
Most existing Python modules for dealing HTTP requests are insane. I have to look up *everything* that I want to do. Most of my worst Python experiences are a result of the various built-in HTTP libraries (yes, even worse than Logging).
|
||||
.. image:: https://img.shields.io/pypi/v/requests.svg
|
||||
:target: https://pypi.python.org/pypi/requests
|
||||
|
||||
But this one's different. This one's going to be awesome. And simple.
|
||||
.. image:: https://img.shields.io/pypi/l/requests.svg
|
||||
:target: https://pypi.python.org/pypi/requests
|
||||
|
||||
Really simple.
|
||||
.. image:: https://img.shields.io/pypi/pyversions/requests.svg
|
||||
:target: https://pypi.python.org/pypi/requests
|
||||
|
||||
Features
|
||||
--------
|
||||
.. image:: https://codecov.io/github/requests/requests/coverage.svg?branch=master
|
||||
:target: https://codecov.io/github/requests/requests
|
||||
:alt: codecov.io
|
||||
|
||||
- Extremely simple GET, HEAD, POST, PUT, DELETE Requests
|
||||
+ Simple HTTP Header Request Attachment
|
||||
+ Simple Data/Params Request Attachment
|
||||
+ Simple Multipart File Uploads
|
||||
+ CookieJar Support
|
||||
|
||||
- Simple Basic HTTP Authentication
|
||||
+ Simple URL + HTTP Auth Registry
|
||||
.. image:: https://img.shields.io/github/contributors/requests/requests.svg
|
||||
:target: https://github.com/requests/requests/graphs/contributors
|
||||
|
||||
.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg
|
||||
:target: https://saythanks.io/to/kennethreitz
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
It couldn't be simpler. ::
|
||||
Requests is the only *Non-GMO* HTTP library for Python, safe for human
|
||||
consumption.
|
||||
|
||||
>>> import requests
|
||||
>>> r = requests.get('http://google.com')
|
||||
**Warning:** Recreational use of the Python standard library for HTTP may result in dangerous side-effects,
|
||||
including: security vulnerabilities, verbose code, reinventing the wheel,
|
||||
constantly reading documentation, depression, headaches, or even death.
|
||||
|
||||
Behold, the power of Requests:
|
||||
|
||||
HTTPS? Basic Authentication? ::
|
||||
|
||||
>>> r = requests.get('https://convore.com/api/account/verify.json')
|
||||
.. code-block:: python
|
||||
|
||||
>>> r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
|
||||
>>> r.status_code
|
||||
401
|
||||
|
||||
|
||||
Uh oh, we're not authorized! Let's add authentication. ::
|
||||
|
||||
>>> conv_auth = requests.AuthObject('requeststest', 'requeststest')
|
||||
>>> r = requests.get('https://convore.com/api/account/verify.json', auth=conv_auth)
|
||||
|
||||
>>> r.status_code
|
||||
200
|
||||
|
||||
200
|
||||
>>> r.headers['content-type']
|
||||
'application/json'
|
||||
|
||||
>>> r.content
|
||||
'{"username": "requeststest", "url": "/users/requeststest/", "id": "9408", "img": "censored-long-url"}'
|
||||
'application/json; charset=utf8'
|
||||
>>> r.encoding
|
||||
'utf-8'
|
||||
>>> r.text
|
||||
u'{"type":"User"...'
|
||||
>>> r.json()
|
||||
{u'disk_usage': 368627, u'private_gists': 484, ...}
|
||||
|
||||
See `the similar code, sans Requests <https://gist.github.com/973705>`_.
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/requests/requests/master/docs/_static/requests-logo-small.png
|
||||
:target: http://docs.python-requests.org/
|
||||
|
||||
|
||||
Requests allows you to send *organic, grass-fed* HTTP/1.1 requests, without the
|
||||
need for manual labor. There's no need to manually add query strings to your
|
||||
URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling
|
||||
are 100% automatic, thanks to `urllib3 <https://github.com/shazow/urllib3>`_.
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
**Requests:**
|
||||
Besides, all the cool kids are doing it. Requests is one of the most
|
||||
downloaded Python packages of all time, pulling in over 11,000,000 downloads
|
||||
every month. You don't want to be left out!
|
||||
|
||||
All request functions return a Response object (see below).
|
||||
Feature Support
|
||||
---------------
|
||||
|
||||
If a {filename: fileobject} dictionary is passed in (files=...), a multipart_encode upload will be performed.
|
||||
If CookieJar object is is passed in (cookies=...), the cookies will be sent with the request.
|
||||
|
||||
GET Requests
|
||||
>>> request.get(url, params={}, headers={}, cookies=None, auth=None)
|
||||
<request object>
|
||||
|
||||
HEAD Requests
|
||||
>>> request.head(url, params={}, headers={}, cookies=None, auth=None)
|
||||
<request object>
|
||||
|
||||
PUT Requests
|
||||
>>> request.put(url, data='', headers={}, files={}, cookies=None, auth=None)
|
||||
<request object>
|
||||
|
||||
POST Requests
|
||||
>>> request.post(url, data={}, headers={}, files={}, cookies=None, auth=None)
|
||||
<request object>
|
||||
|
||||
DELETE Requests
|
||||
>>> request.delete(url, params={}, headers={}, cookies=None, auth=None)
|
||||
<request object>
|
||||
|
||||
|
||||
**Responses:**
|
||||
|
||||
Request.status_code:
|
||||
(Integer) Received HTTP Status Code Response
|
||||
|
||||
Request.headers:
|
||||
(Dictionary) Received HTTP Response Headers
|
||||
|
||||
Request.content:
|
||||
(Bytes) Received Content
|
||||
|
||||
Request.url
|
||||
(String) URL of response. Useful for detecting redirects.
|
||||
|
||||
|
||||
**HTTP Authentication Registry:**
|
||||
|
||||
You can register AuthObjects to automatically enable HTTP Authentication on requests that contain a registered base URL string.
|
||||
|
||||
>>> requests.add_autoauth(url, authobject)
|
||||
Requests is ready for today's web.
|
||||
|
||||
- International Domains and URLs
|
||||
- Keep-Alive & Connection Pooling
|
||||
- Sessions with Cookie Persistence
|
||||
- Browser-style SSL Verification
|
||||
- Basic/Digest Authentication
|
||||
- Elegant Key/Value Cookies
|
||||
- Automatic Decompression
|
||||
- Automatic Content Decoding
|
||||
- Unicode Response Bodies
|
||||
- Multipart File Uploads
|
||||
- HTTP(S) Proxy Support
|
||||
- Connection Timeouts
|
||||
- Streaming Downloads
|
||||
- ``.netrc`` Support
|
||||
- Chunked Requests
|
||||
|
||||
Requests officially supports Python 2.6–2.7 & 3.3–3.7, and runs great on PyPy.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
To install requests, simply: ::
|
||||
To install Requests, simply:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pip install requests
|
||||
|
||||
Or, if you absolutely must: ::
|
||||
✨🍰✨
|
||||
|
||||
$ easy_install requests
|
||||
Satisfaction guaranteed.
|
||||
|
||||
But, you really shouldn't do that.
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
Fantastic documentation is available at http://docs.python-requests.org/, for a limited time only.
|
||||
|
||||
|
||||
Contribute
|
||||
----------
|
||||
How to Contribute
|
||||
-----------------
|
||||
|
||||
If you'd like to contribute, simply fork `the repository`_, commit your changes to the **develop** branch (or branch off of it), and send a pull request. Make sure you add yourself to AUTHORS_.
|
||||
#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a `Contributor Friendly`_ tag for issues that should be ideal for people who are not very familiar with the codebase yet.
|
||||
#. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it).
|
||||
#. Write a test which shows that the bug was fixed or that the feature works as expected.
|
||||
#. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_.
|
||||
|
||||
|
||||
|
||||
Roadmap
|
||||
-------
|
||||
|
||||
- Sphinx Documentation
|
||||
- Exhaustive Unittests
|
||||
|
||||
.. _`the repository`: http://github.com/kennethreitz/requests
|
||||
.. _AUTHORS: http://github.com/kennethreitz/requests/blob/master/AUTHORS
|
||||
.. _`the repository`: http://github.com/requests/requests
|
||||
.. _AUTHORS: https://github.com/requests/requests/blob/master/AUTHORS.rst
|
||||
.. _Contributor Friendly: https://github.com/requests/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open
|
||||
|
||||
229
_appveyor/install.ps1
Normal file
229
_appveyor/install.ps1
Normal file
@@ -0,0 +1,229 @@
|
||||
# Sample script to install Python and pip under Windows
|
||||
# Authors: Olivier Grisel, Jonathan Helmus, Kyle Kastner, and Alex Willmer
|
||||
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
|
||||
$BASE_URL = "https://www.python.org/ftp/python/"
|
||||
$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
|
||||
$GET_PIP_PATH = "C:\get-pip.py"
|
||||
|
||||
$PYTHON_PRERELEASE_REGEX = @"
|
||||
(?x)
|
||||
(?<major>\d+)
|
||||
\.
|
||||
(?<minor>\d+)
|
||||
\.
|
||||
(?<micro>\d+)
|
||||
(?<prerelease>[a-z]{1,2}\d+)
|
||||
"@
|
||||
|
||||
|
||||
function Download ($filename, $url) {
|
||||
$webclient = New-Object System.Net.WebClient
|
||||
|
||||
$basedir = $pwd.Path + "\"
|
||||
$filepath = $basedir + $filename
|
||||
if (Test-Path $filename) {
|
||||
Write-Host "Reusing" $filepath
|
||||
return $filepath
|
||||
}
|
||||
|
||||
# Download and retry up to 3 times in case of network transient errors.
|
||||
Write-Host "Downloading" $filename "from" $url
|
||||
$retry_attempts = 2
|
||||
for ($i = 0; $i -lt $retry_attempts; $i++) {
|
||||
try {
|
||||
$webclient.DownloadFile($url, $filepath)
|
||||
break
|
||||
}
|
||||
Catch [Exception]{
|
||||
Start-Sleep 1
|
||||
}
|
||||
}
|
||||
if (Test-Path $filepath) {
|
||||
Write-Host "File saved at" $filepath
|
||||
} else {
|
||||
# Retry once to get the error message if any at the last try
|
||||
$webclient.DownloadFile($url, $filepath)
|
||||
}
|
||||
return $filepath
|
||||
}
|
||||
|
||||
|
||||
function ParsePythonVersion ($python_version) {
|
||||
if ($python_version -match $PYTHON_PRERELEASE_REGEX) {
|
||||
return ([int]$matches.major, [int]$matches.minor, [int]$matches.micro,
|
||||
$matches.prerelease)
|
||||
}
|
||||
$version_obj = [version]$python_version
|
||||
return ($version_obj.major, $version_obj.minor, $version_obj.build, "")
|
||||
}
|
||||
|
||||
|
||||
function DownloadPython ($python_version, $platform_suffix) {
|
||||
$major, $minor, $micro, $prerelease = ParsePythonVersion $python_version
|
||||
|
||||
if (($major -le 2 -and $micro -eq 0) `
|
||||
-or ($major -eq 3 -and $minor -le 2 -and $micro -eq 0) `
|
||||
) {
|
||||
$dir = "$major.$minor"
|
||||
$python_version = "$major.$minor$prerelease"
|
||||
} else {
|
||||
$dir = "$major.$minor.$micro"
|
||||
}
|
||||
|
||||
if ($prerelease) {
|
||||
if (($major -le 2) `
|
||||
-or ($major -eq 3 -and $minor -eq 1) `
|
||||
-or ($major -eq 3 -and $minor -eq 2) `
|
||||
-or ($major -eq 3 -and $minor -eq 3) `
|
||||
) {
|
||||
$dir = "$dir/prev"
|
||||
}
|
||||
}
|
||||
|
||||
if (($major -le 2) -or ($major -le 3 -and $minor -le 4)) {
|
||||
$ext = "msi"
|
||||
if ($platform_suffix) {
|
||||
$platform_suffix = ".$platform_suffix"
|
||||
}
|
||||
} else {
|
||||
$ext = "exe"
|
||||
if ($platform_suffix) {
|
||||
$platform_suffix = "-$platform_suffix"
|
||||
}
|
||||
}
|
||||
|
||||
$filename = "python-$python_version$platform_suffix.$ext"
|
||||
$url = "$BASE_URL$dir/$filename"
|
||||
$filepath = Download $filename $url
|
||||
return $filepath
|
||||
}
|
||||
|
||||
|
||||
function InstallPython ($python_version, $architecture, $python_home) {
|
||||
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
|
||||
if (Test-Path $python_home) {
|
||||
Write-Host $python_home "already exists, skipping."
|
||||
return $false
|
||||
}
|
||||
if ($architecture -eq "32") {
|
||||
$platform_suffix = ""
|
||||
} else {
|
||||
$platform_suffix = "amd64"
|
||||
}
|
||||
$installer_path = DownloadPython $python_version $platform_suffix
|
||||
$installer_ext = [System.IO.Path]::GetExtension($installer_path)
|
||||
Write-Host "Installing $installer_path to $python_home"
|
||||
$install_log = $python_home + ".log"
|
||||
if ($installer_ext -eq '.msi') {
|
||||
InstallPythonMSI $installer_path $python_home $install_log
|
||||
} else {
|
||||
InstallPythonEXE $installer_path $python_home $install_log
|
||||
}
|
||||
if (Test-Path $python_home) {
|
||||
Write-Host "Python $python_version ($architecture) installation complete"
|
||||
} else {
|
||||
Write-Host "Failed to install Python in $python_home"
|
||||
Get-Content -Path $install_log
|
||||
Exit 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function InstallPythonEXE ($exepath, $python_home, $install_log) {
|
||||
$install_args = "/quiet InstallAllUsers=1 TargetDir=$python_home"
|
||||
RunCommand $exepath $install_args
|
||||
}
|
||||
|
||||
|
||||
function InstallPythonMSI ($msipath, $python_home, $install_log) {
|
||||
$install_args = "/qn /log $install_log /i $msipath TARGETDIR=$python_home"
|
||||
$uninstall_args = "/qn /x $msipath"
|
||||
RunCommand "msiexec.exe" $install_args
|
||||
if (-not(Test-Path $python_home)) {
|
||||
Write-Host "Python seems to be installed else-where, reinstalling."
|
||||
RunCommand "msiexec.exe" $uninstall_args
|
||||
RunCommand "msiexec.exe" $install_args
|
||||
}
|
||||
}
|
||||
|
||||
function RunCommand ($command, $command_args) {
|
||||
Write-Host $command $command_args
|
||||
Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru
|
||||
}
|
||||
|
||||
|
||||
function InstallPip ($python_home) {
|
||||
$pip_path = $python_home + "\Scripts\pip.exe"
|
||||
$python_path = $python_home + "\python.exe"
|
||||
if (-not(Test-Path $pip_path)) {
|
||||
Write-Host "Installing pip..."
|
||||
$webclient = New-Object System.Net.WebClient
|
||||
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
|
||||
Write-Host "Executing:" $python_path $GET_PIP_PATH
|
||||
& $python_path $GET_PIP_PATH
|
||||
} else {
|
||||
Write-Host "pip already installed."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function DownloadMiniconda ($python_version, $platform_suffix) {
|
||||
if ($python_version -eq "3.4") {
|
||||
$filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe"
|
||||
} else {
|
||||
$filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe"
|
||||
}
|
||||
$url = $MINICONDA_URL + $filename
|
||||
$filepath = Download $filename $url
|
||||
return $filepath
|
||||
}
|
||||
|
||||
|
||||
function InstallMiniconda ($python_version, $architecture, $python_home) {
|
||||
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
|
||||
if (Test-Path $python_home) {
|
||||
Write-Host $python_home "already exists, skipping."
|
||||
return $false
|
||||
}
|
||||
if ($architecture -eq "32") {
|
||||
$platform_suffix = "x86"
|
||||
} else {
|
||||
$platform_suffix = "x86_64"
|
||||
}
|
||||
$filepath = DownloadMiniconda $python_version $platform_suffix
|
||||
Write-Host "Installing" $filepath "to" $python_home
|
||||
$install_log = $python_home + ".log"
|
||||
$args = "/S /D=$python_home"
|
||||
Write-Host $filepath $args
|
||||
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
|
||||
if (Test-Path $python_home) {
|
||||
Write-Host "Python $python_version ($architecture) installation complete"
|
||||
} else {
|
||||
Write-Host "Failed to install Python in $python_home"
|
||||
Get-Content -Path $install_log
|
||||
Exit 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function InstallMinicondaPip ($python_home) {
|
||||
$pip_path = $python_home + "\Scripts\pip.exe"
|
||||
$conda_path = $python_home + "\Scripts\conda.exe"
|
||||
if (-not(Test-Path $pip_path)) {
|
||||
Write-Host "Installing pip..."
|
||||
$args = "install --yes pip"
|
||||
Write-Host $conda_path $args
|
||||
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
|
||||
} else {
|
||||
Write-Host "pip already installed."
|
||||
}
|
||||
}
|
||||
|
||||
function main () {
|
||||
InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
|
||||
InstallPip $env:PYTHON
|
||||
}
|
||||
|
||||
main
|
||||
51
appveyor.yml
Normal file
51
appveyor.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
# AppVeyor.yml from https://github.com/ogrisel/python-appveyor-demo
|
||||
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
build: off
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- PYTHON: "C:\\Python27-x64"
|
||||
PYTHON_VERSION: "2.7.x"
|
||||
PYTHON_ARCH: "64"
|
||||
TOXENV: "py27"
|
||||
|
||||
- PYTHON: "C:\\Python34-x64"
|
||||
PYTHON_VERSION: "3.4.x"
|
||||
PYTHON_ARCH: "64"
|
||||
TOXENV: "py34"
|
||||
|
||||
- PYTHON: "C:\\Python35-x64"
|
||||
PYTHON_VERSION: "3.5.x"
|
||||
PYTHON_ARCH: "64"
|
||||
TOXENV: "py35"
|
||||
|
||||
- PYTHON: "C:\\Python36-x64"
|
||||
PYTHON_VERSION: "3.6.x"
|
||||
PYTHON_ARCH: "64"
|
||||
TOXENV: "py36"
|
||||
|
||||
install:
|
||||
# Install Python (from the official .msi of http://python.org) and pip when
|
||||
# not already installed.
|
||||
- ps: if (-not(Test-Path($env:PYTHON))) { & _appveyor\install.ps1 }
|
||||
|
||||
# Prepend newly installed Python to the PATH of this build (this cannot be
|
||||
# done from inside the powershell script as it would require to restart
|
||||
# the parent CMD process).
|
||||
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
|
||||
|
||||
# Check that we have the expected version and architecture for Python
|
||||
- "python --version"
|
||||
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
|
||||
|
||||
# Upgrade to the latest version of pip to avoid it displaying warnings
|
||||
# about it being out of date.
|
||||
- "pip install --disable-pip-version-check --user --upgrade pip"
|
||||
- "C:\\MinGW\\bin\\mingw32-make"
|
||||
|
||||
test_script:
|
||||
- "C:\\MinGW\\bin\\mingw32-make coverage"
|
||||
|
||||
on_success:
|
||||
- "codecov -f coverage.xml"
|
||||
@@ -1 +0,0 @@
|
||||
include HISTORY.rst README.rst LICENSE
|
||||
@@ -7,6 +7,11 @@ SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
||||
# User-friendly check for sphinx-build
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||
endif
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
@@ -14,8 +19,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@@ -25,53 +29,66 @@ help:
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " applehelp to make an Apple Help Book"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " xml to make Docutils-native XML files"
|
||||
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
@echo " coverage to run coverage check of the documentation (if enabled)"
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-rm -rf $(BUILDDIR)/*
|
||||
rm -rf $(BUILDDIR)/*
|
||||
|
||||
.PHONY: html
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
.PHONY: dirhtml
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
.PHONY: singlehtml
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
.PHONY: pickle
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
.PHONY: json
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
.PHONY: htmlhelp
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
.PHONY: qthelp
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@@ -81,6 +98,16 @@ qthelp:
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Requests.qhc"
|
||||
|
||||
.PHONY: applehelp
|
||||
applehelp:
|
||||
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
|
||||
@echo
|
||||
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
|
||||
@echo "N.B. You won't be able to view it unless you put it in" \
|
||||
"~/Library/Documentation/Help or install it in your application" \
|
||||
"bundle."
|
||||
|
||||
.PHONY: devhelp
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@@ -90,11 +117,13 @@ devhelp:
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Requests"
|
||||
@echo "# devhelp"
|
||||
|
||||
.PHONY: epub
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
.PHONY: latex
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@@ -102,22 +131,33 @@ latex:
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
.PHONY: latexpdf
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
make -C $(BUILDDIR)/latex all-pdf
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
.PHONY: latexpdfja
|
||||
latexpdfja:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
.PHONY: text
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
.PHONY: man
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
.PHONY: texinfo
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@@ -125,29 +165,52 @@ texinfo:
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
.PHONY: info
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
.PHONY: gettext
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
.PHONY: changes
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
.PHONY: linkcheck
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
.PHONY: doctest
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
|
||||
.PHONY: coverage
|
||||
coverage:
|
||||
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
|
||||
@echo "Testing of coverage in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/coverage/python.txt."
|
||||
|
||||
.PHONY: xml
|
||||
xml:
|
||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||
@echo
|
||||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||
|
||||
.PHONY: pseudoxml
|
||||
pseudoxml:
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||
|
||||
39
docs/_static/custom.css
vendored
Normal file
39
docs/_static/custom.css
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
#carbonads {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
padding: 1em;
|
||||
background-color: #eeeeee;
|
||||
text-align: center;
|
||||
border: solid 1px #cccccc;
|
||||
margin: 1.5em 0 2em;
|
||||
border-radius: 2px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
#carbonads a {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
#carbonads span {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.carbon-img {
|
||||
display: block;
|
||||
margin: 0 auto 1em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.carbon-text {
|
||||
display: block;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.carbon-poweredby {
|
||||
display: block;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
line-height: 1;
|
||||
font-size: 10px;
|
||||
}
|
||||
116
docs/_static/konami.js
vendored
Normal file
116
docs/_static/konami.js
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Konami-JS ~
|
||||
* :: Now with support for touch events and multiple instances for
|
||||
* :: those situations that call for multiple easter eggs!
|
||||
* Code: http://konami-js.googlecode.com/
|
||||
* Examples: http://www.snaptortoise.com/konami-js
|
||||
* Copyright (c) 2009 George Mandis (georgemandis.com, snaptortoise.com)
|
||||
* Version: 1.4.2 (9/2/2013)
|
||||
* Licensed under the MIT License (http://opensource.org/licenses/MIT)
|
||||
* Tested in: Safari 4+, Google Chrome 4+, Firefox 3+, IE7+, Mobile Safari 2.2.1 and Dolphin Browser
|
||||
*/
|
||||
|
||||
var Konami = function (callback) {
|
||||
var konami = {
|
||||
addEvent: function (obj, type, fn, ref_obj) {
|
||||
if (obj.addEventListener)
|
||||
obj.addEventListener(type, fn, false);
|
||||
else if (obj.attachEvent) {
|
||||
// IE
|
||||
obj["e" + type + fn] = fn;
|
||||
obj[type + fn] = function () {
|
||||
obj["e" + type + fn](window.event, ref_obj);
|
||||
};
|
||||
obj.attachEvent("on" + type, obj[type + fn]);
|
||||
}
|
||||
},
|
||||
input: "",
|
||||
pattern: "38384040373937396665",
|
||||
load: function (link) {
|
||||
this.addEvent(document, "keydown", function (e, ref_obj) {
|
||||
if (ref_obj) konami = ref_obj; // IE
|
||||
konami.input += e ? e.keyCode : event.keyCode;
|
||||
if (konami.input.length > konami.pattern.length)
|
||||
konami.input = konami.input.substr((konami.input.length - konami.pattern.length));
|
||||
if (konami.input == konami.pattern) {
|
||||
konami.code(link);
|
||||
konami.input = "";
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}, this);
|
||||
this.iphone.load(link);
|
||||
},
|
||||
code: function (link) {
|
||||
window.location = link
|
||||
},
|
||||
iphone: {
|
||||
start_x: 0,
|
||||
start_y: 0,
|
||||
stop_x: 0,
|
||||
stop_y: 0,
|
||||
tapTolerance: 8,
|
||||
capture: false,
|
||||
orig_keys: "",
|
||||
keys: ["UP", "UP", "DOWN", "DOWN", "LEFT", "RIGHT", "LEFT", "RIGHT", "TAP", "TAP"],
|
||||
code: function (link) {
|
||||
konami.code(link);
|
||||
},
|
||||
touchCapture: function(evt) {
|
||||
konami.iphone.start_x = evt.changedTouches[0].pageX;
|
||||
konami.iphone.start_y = evt.changedTouches[0].pageY;
|
||||
konami.iphone.capture = true;
|
||||
},
|
||||
load: function (link) {
|
||||
this.orig_keys = this.keys;
|
||||
konami.addEvent(document, "touchmove", function (e) {
|
||||
if (e.touches.length == 1 && konami.iphone.capture == true) {
|
||||
var touch = e.touches[0];
|
||||
konami.iphone.stop_x = touch.pageX;
|
||||
konami.iphone.stop_y = touch.pageY;
|
||||
konami.iphone.check_direction();
|
||||
}
|
||||
});
|
||||
konami.addEvent(document, "touchend", function (evt) {
|
||||
konami.touchCapture(evt);
|
||||
konami.iphone.check_direction(link);
|
||||
}, false);
|
||||
konami.addEvent(document, "touchstart", function (evt) {
|
||||
konami.touchCapture(evt);
|
||||
});
|
||||
},
|
||||
check_direction: function (link) {
|
||||
var x_magnitude = Math.abs(this.start_x - this.stop_x);
|
||||
var y_magnitude = Math.abs(this.start_y - this.stop_y);
|
||||
var hasMoved = (x_magnitude > this.tapTolerance || y_magnitude > this.tapTolerance);
|
||||
var result;
|
||||
if (this.capture === true && hasMoved) {
|
||||
this.capture = false;
|
||||
var x = ((this.start_x - this.stop_x) < 0) ? "RIGHT" : "LEFT";
|
||||
var y = ((this.start_y - this.stop_y) < 0) ? "DOWN" : "UP";
|
||||
var result = (x_magnitude > y_magnitude) ? x : y;
|
||||
}
|
||||
else if (this.capture === false && !hasMoved) {
|
||||
result = (this.tap == true) ? "TAP" : result;
|
||||
result = "TAP";
|
||||
}
|
||||
if (result) {
|
||||
if (result == this.keys[0]) this.keys = this.keys.slice(1, this.keys.length);
|
||||
else this.keys = this.orig_keys;
|
||||
}
|
||||
if (this.keys.length == 0) {
|
||||
this.keys = this.orig_keys;
|
||||
this.code(link);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typeof callback === "string" && konami.load(callback);
|
||||
if (typeof callback === "function") {
|
||||
konami.code = callback;
|
||||
konami.load();
|
||||
}
|
||||
|
||||
return konami;
|
||||
};
|
||||
BIN
docs/_static/requests-logo-small.png
vendored
Normal file
BIN
docs/_static/requests-logo-small.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 155 KiB |
BIN
docs/_static/requests-sidebar.png
vendored
Normal file
BIN
docs/_static/requests-sidebar.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 299 KiB |
54
docs/_templates/hacks.html
vendored
Normal file
54
docs/_templates/hacks.html
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<!-- Alabaster (krTheme++) Hacks -->
|
||||
|
||||
<!-- CSS Adjustments (I'm very picky.) -->
|
||||
<style type="text/css">
|
||||
|
||||
/* Rezzy requires precise alignment. */
|
||||
img.logo {margin-left: -20px!important;}
|
||||
|
||||
/* "Quick Search" should be capitalized. */
|
||||
div#searchbox h3 {text-transform: capitalize;}
|
||||
|
||||
/* Make the document a little wider, less code is cut-off. */
|
||||
div.document {width: 1008px;}
|
||||
|
||||
/* Much-improved spacing around code blocks. */
|
||||
div.highlight pre {padding: 11px 14px;}
|
||||
|
||||
/* Remain Responsive! */
|
||||
@media screen and (max-width: 1008px) {
|
||||
div.sphinxsidebar {display: none;}
|
||||
div.document {width: 100%!important;}
|
||||
|
||||
/* Have code blocks escape the document right-margin. */
|
||||
div.highlight pre {margin-right: -30px;}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<!-- Analytics tracking for Kenneth. -->
|
||||
<script type="text/javascript">
|
||||
var _gauges = _gauges || [];
|
||||
(function() {
|
||||
var t = document.createElement('script');
|
||||
t.type = 'text/javascript';
|
||||
t.async = true;
|
||||
t.id = 'gauges-tracker';
|
||||
t.setAttribute('data-site-id', '56ca7a57c88d9011080024dd');
|
||||
t.setAttribute('data-track-path', 'https://track.gaug.es/track.gif');
|
||||
t.src = 'https://d36ee2fcip1434.cloudfront.net/track.js';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(t, s);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- There are no more hacks. -->
|
||||
<!-- இڿڰۣ-ڰۣ— -->
|
||||
<!-- Love, Kenneth Reitz -->
|
||||
|
||||
<script src="{{ pathto('_static/', 1) }}/konami.js"></script>
|
||||
<script>
|
||||
var easter_egg = new Konami('http://fortunes.herokuapp.com/random/raw');
|
||||
</script>
|
||||
|
||||
<!-- That was not a hack. That was art. -->
|
||||
71
docs/_templates/sidebarintro.html
vendored
Normal file
71
docs/_templates/sidebarintro.html
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<p class="logo">
|
||||
<a href="{{ pathto(master_doc) }}">
|
||||
<img class="logo" src="{{ pathto('_static/requests-sidebar.png', 1) }}" title="https://kennethreitz.org/tattoos"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<iframe src="http://ghbtns.com/github-btn.html?user=requests&repo=requests&type=watch&count=true&size=large"
|
||||
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Requests is an elegant and simple HTTP library for Python, built for
|
||||
human beings.
|
||||
</p>
|
||||
|
||||
<script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=pythonrequestsorg" id="_carbonads_js"></script>
|
||||
|
||||
<h3>Stay Informed</h3>
|
||||
<p>Receive updates on new releases and upcoming projects.</p>
|
||||
|
||||
<p><iframe src="http://ghbtns.com/github-btn.html?user=kennethreitz&type=follow&count=false"
|
||||
allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20"></iframe></p>
|
||||
|
||||
<p><a href="https://twitter.com/kennethreitz" class="twitter-follow-button" data-show-count="false">Follow @kennethreitz</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></p>
|
||||
<p><a href="https://saythanks.io/to/kennethreitz">Say Thanks!</a></p>
|
||||
<p><a href="http://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>
|
||||
|
||||
|
||||
<h3>Other Projects</h3>
|
||||
|
||||
<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p>
|
||||
<ul>
|
||||
<li><a href="http://edmsynths.com/">edmsynths.com</a></li>
|
||||
<li><a href="http://pipenv.org/">pipenv</a></li>
|
||||
<li><a href="http://pep8.org/">pep8.org</a></li>
|
||||
<li><a href="http://httpbin.org/">httpbin.org</a></li>
|
||||
<li><a href="http://python-guide.org">The Python Guide</a></li>
|
||||
<li><a href="https://github.com/kennethreitz/maya">Maya: Datetimes for Humans</a></li>
|
||||
<li><a href="https://github.com/kennethreitz/records">Records: SQL for Humans</a></li>
|
||||
<li><a href="http://www.git-legit.org">Legit: Git for Humans</a></li>
|
||||
<li><a href="http://docs.python-tablib.org/en/latest/">Tablib: Tabular Datasets</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Useful Links</h3>
|
||||
<ul>
|
||||
<li><a href="http://docs.python-requests.org/en/latest/community/recommended/">Recommended Packages and Extensions</a></li>
|
||||
|
||||
<p></p>
|
||||
|
||||
<li><a href="http://github.com/requests/requests">Requests @ GitHub</a></li>
|
||||
<li><a href="http://pypi.python.org/pypi/requests">Requests @ PyPI</a></li>
|
||||
<li><a href="http://github.com/requests/requests/issues">Issue Tracker</a></li>
|
||||
<li><a href="http://docs.python-requests.org/en/latest/community/updates/#software-updates">Release History</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Translations</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://docs.python-requests.org/">English</a></li>
|
||||
<li><a href="http://fr.python-requests.org/">French</a></li>
|
||||
<li><a href="http://de.python-requests.org/">German</a></li>
|
||||
<li><a href="http://jp.python-requests.org/">Japanese</a></li>
|
||||
<li><a href="http://cn.python-requests.org/">Chinese</a></li>
|
||||
<li><a href="http://pt.python-requests.org/">Portuguese</a></li>
|
||||
<li><a href="http://it.python-requests.org/">Italian</a></li>
|
||||
<li><a href="http://es.python-requests.org/">Spanish</a></li>
|
||||
</ul>
|
||||
|
||||
62
docs/_templates/sidebarlogo.html
vendored
Normal file
62
docs/_templates/sidebarlogo.html
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<p class="logo">
|
||||
<a href="{{ pathto(master_doc) }}">
|
||||
<img class="logo" src="{{ pathto('_static/requests-sidebar.png', 1) }}" title="https://kennethreitz.org/tattoos"/>
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<iframe src="http://ghbtns.com/github-btn.html?user=requests&repo=requests&type=watch&count=true&size=large"
|
||||
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Requests is an elegant and simple HTTP library for Python, built for
|
||||
human beings. You are currently looking at the documentation of the
|
||||
development release.
|
||||
</p>
|
||||
|
||||
<h3>Stay Informed</h3>
|
||||
<p>Receive updates on new releases and upcoming projects.</p>
|
||||
|
||||
<p><a href="http://tinyletter.com/kennethreitz">Join Mailing List</a>.</p>
|
||||
|
||||
<hr/>
|
||||
|
||||
<script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=pythonrequestsorg" id="_carbonads_js"></script>
|
||||
|
||||
<p>If you enjoy using this project, <a href="https://saythanks.io/to/kennethreitz">Say Thanks!</a></p>
|
||||
|
||||
<p><iframe src="http://ghbtns.com/github-btn.html?user=kennethreitz&type=follow&count=false"
|
||||
allowtransparency="true" frameborder="0" scrolling="0" width="200" height="20"></iframe></p>
|
||||
|
||||
<p><a href="https://twitter.com/kennethreitz" class="twitter-follow-button" data-show-count="false">Follow @kennethreitz</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></p>
|
||||
|
||||
|
||||
<h3>Other Projects</h3>
|
||||
|
||||
<p>More <a href="http://kennethreitz.org/">Kenneth Reitz</a> projects:</p>
|
||||
<ul>
|
||||
<li><a href="http://edmsynths.com/">edmsynths.com</a></li>
|
||||
<li><a href="http://pipenv.org/">pipenv</a></li>
|
||||
<li><a href="http://pep8.org/">pep8.org</a></li>
|
||||
<li><a href="http://httpbin.org/">httpbin.org</a></li>
|
||||
<li><a href="http://python-guide.org">The Python Guide</a></li>
|
||||
<li><a href="https://github.com/kennethreitz/maya">Maya: Datetimes for Humans</a></li>
|
||||
<li><a href="https://github.com/kennethreitz/records">Records: SQL for Humans</a></li>
|
||||
<li><a href="http://www.git-legit.org">Legit: Git for Humans</a></li>
|
||||
<li><a href="http://docs.python-tablib.org/en/latest/">Tablib: Tabular Datasets</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>Translations</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://docs.python-requests.org/">English</a></li>
|
||||
<li><a href="http://fr.python-requests.org/">French</a></li>
|
||||
<li><a href="http://de.python-requests.org/">German</a></li>
|
||||
<li><a href="http://jp.python-requests.org/">Japanese</a></li>
|
||||
<li><a href="http://cn.python-requests.org/">Chinese</a></li>
|
||||
<li><a href="http://pt.python-requests.org/">Portuguese</a></li>
|
||||
<li><a href="http://it.python-requests.org/">Italian</a></li>
|
||||
<li><a href="http://es.python-requests.org/">Spanish</a></li>
|
||||
</ul>
|
||||
|
||||
3
docs/_themes/.gitignore
vendored
Normal file
3
docs/_themes/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.pyc
|
||||
*.pyo
|
||||
.DS_Store
|
||||
45
docs/_themes/LICENSE
vendored
Normal file
45
docs/_themes/LICENSE
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
Modifications:
|
||||
|
||||
Copyright (c) 2011 Kenneth Reitz.
|
||||
|
||||
|
||||
Original Project:
|
||||
|
||||
Copyright (c) 2010 by Armin Ronacher.
|
||||
|
||||
|
||||
Some rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms of the theme, with or
|
||||
without modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
|
||||
* The names of the contributors may not be used to endorse or
|
||||
promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
We kindly ask you to only use these themes in an unmodified manner just
|
||||
for Flask and Flask-related products, not for unrelated projects. If you
|
||||
like the visual style and want to use it for your own projects, please
|
||||
consider making some larger changes to the themes (such as changing
|
||||
font faces, sizes, colors or margins).
|
||||
|
||||
THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
86
docs/_themes/flask_theme_support.py
vendored
Normal file
86
docs/_themes/flask_theme_support.py
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
# flasky extensions. flasky pygments style based on tango style
|
||||
from pygments.style import Style
|
||||
from pygments.token import Keyword, Name, Comment, String, Error, \
|
||||
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
|
||||
|
||||
|
||||
class FlaskyStyle(Style):
|
||||
background_color = "#f8f8f8"
|
||||
default_style = ""
|
||||
|
||||
styles = {
|
||||
# No corresponding class for the following:
|
||||
#Text: "", # class: ''
|
||||
Whitespace: "underline #f8f8f8", # class: 'w'
|
||||
Error: "#a40000 border:#ef2929", # class: 'err'
|
||||
Other: "#000000", # class 'x'
|
||||
|
||||
Comment: "italic #8f5902", # class: 'c'
|
||||
Comment.Preproc: "noitalic", # class: 'cp'
|
||||
|
||||
Keyword: "bold #004461", # class: 'k'
|
||||
Keyword.Constant: "bold #004461", # class: 'kc'
|
||||
Keyword.Declaration: "bold #004461", # class: 'kd'
|
||||
Keyword.Namespace: "bold #004461", # class: 'kn'
|
||||
Keyword.Pseudo: "bold #004461", # class: 'kp'
|
||||
Keyword.Reserved: "bold #004461", # class: 'kr'
|
||||
Keyword.Type: "bold #004461", # class: 'kt'
|
||||
|
||||
Operator: "#582800", # class: 'o'
|
||||
Operator.Word: "bold #004461", # class: 'ow' - like keywords
|
||||
|
||||
Punctuation: "bold #000000", # class: 'p'
|
||||
|
||||
# because special names such as Name.Class, Name.Function, etc.
|
||||
# are not recognized as such later in the parsing, we choose them
|
||||
# to look the same as ordinary variables.
|
||||
Name: "#000000", # class: 'n'
|
||||
Name.Attribute: "#c4a000", # class: 'na' - to be revised
|
||||
Name.Builtin: "#004461", # class: 'nb'
|
||||
Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
|
||||
Name.Class: "#000000", # class: 'nc' - to be revised
|
||||
Name.Constant: "#000000", # class: 'no' - to be revised
|
||||
Name.Decorator: "#888", # class: 'nd' - to be revised
|
||||
Name.Entity: "#ce5c00", # class: 'ni'
|
||||
Name.Exception: "bold #cc0000", # class: 'ne'
|
||||
Name.Function: "#000000", # class: 'nf'
|
||||
Name.Property: "#000000", # class: 'py'
|
||||
Name.Label: "#f57900", # class: 'nl'
|
||||
Name.Namespace: "#000000", # class: 'nn' - to be revised
|
||||
Name.Other: "#000000", # class: 'nx'
|
||||
Name.Tag: "bold #004461", # class: 'nt' - like a keyword
|
||||
Name.Variable: "#000000", # class: 'nv' - to be revised
|
||||
Name.Variable.Class: "#000000", # class: 'vc' - to be revised
|
||||
Name.Variable.Global: "#000000", # class: 'vg' - to be revised
|
||||
Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
|
||||
|
||||
Number: "#990000", # class: 'm'
|
||||
|
||||
Literal: "#000000", # class: 'l'
|
||||
Literal.Date: "#000000", # class: 'ld'
|
||||
|
||||
String: "#4e9a06", # class: 's'
|
||||
String.Backtick: "#4e9a06", # class: 'sb'
|
||||
String.Char: "#4e9a06", # class: 'sc'
|
||||
String.Doc: "italic #8f5902", # class: 'sd' - like a comment
|
||||
String.Double: "#4e9a06", # class: 's2'
|
||||
String.Escape: "#4e9a06", # class: 'se'
|
||||
String.Heredoc: "#4e9a06", # class: 'sh'
|
||||
String.Interpol: "#4e9a06", # class: 'si'
|
||||
String.Other: "#4e9a06", # class: 'sx'
|
||||
String.Regex: "#4e9a06", # class: 'sr'
|
||||
String.Single: "#4e9a06", # class: 's1'
|
||||
String.Symbol: "#4e9a06", # class: 'ss'
|
||||
|
||||
Generic: "#000000", # class: 'g'
|
||||
Generic.Deleted: "#a40000", # class: 'gd'
|
||||
Generic.Emph: "italic #000000", # class: 'ge'
|
||||
Generic.Error: "#ef2929", # class: 'gr'
|
||||
Generic.Heading: "bold #000080", # class: 'gh'
|
||||
Generic.Inserted: "#00A000", # class: 'gi'
|
||||
Generic.Output: "#888", # class: 'go'
|
||||
Generic.Prompt: "#745334", # class: 'gp'
|
||||
Generic.Strong: "bold #000000", # class: 'gs'
|
||||
Generic.Subheading: "bold #800080", # class: 'gu'
|
||||
Generic.Traceback: "bold #a40000", # class: 'gt'
|
||||
}
|
||||
270
docs/api.rst
Normal file
270
docs/api.rst
Normal file
@@ -0,0 +1,270 @@
|
||||
.. _api:
|
||||
|
||||
Developer Interface
|
||||
===================
|
||||
|
||||
.. module:: requests
|
||||
|
||||
This part of the documentation covers all the interfaces of Requests. For
|
||||
parts where Requests depends on external libraries, we document the most
|
||||
important right here and provide links to the canonical documentation.
|
||||
|
||||
|
||||
Main Interface
|
||||
--------------
|
||||
|
||||
All of Requests' functionality can be accessed by these 7 methods.
|
||||
They all return an instance of the :class:`Response <Response>` object.
|
||||
|
||||
.. autofunction:: request
|
||||
|
||||
.. autofunction:: head
|
||||
.. autofunction:: get
|
||||
.. autofunction:: post
|
||||
.. autofunction:: put
|
||||
.. autofunction:: patch
|
||||
.. autofunction:: delete
|
||||
|
||||
Exceptions
|
||||
----------
|
||||
|
||||
.. autoexception:: requests.RequestException
|
||||
.. autoexception:: requests.ConnectionError
|
||||
.. autoexception:: requests.HTTPError
|
||||
.. autoexception:: requests.URLRequired
|
||||
.. autoexception:: requests.TooManyRedirects
|
||||
.. autoexception:: requests.ConnectTimeout
|
||||
.. autoexception:: requests.ReadTimeout
|
||||
.. autoexception:: requests.Timeout
|
||||
|
||||
|
||||
Request Sessions
|
||||
----------------
|
||||
|
||||
.. _sessionapi:
|
||||
|
||||
.. autoclass:: Session
|
||||
:inherited-members:
|
||||
|
||||
|
||||
Lower-Level Classes
|
||||
-------------------
|
||||
|
||||
.. autoclass:: requests.Request
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: Response
|
||||
:inherited-members:
|
||||
|
||||
|
||||
Lower-Lower-Level Classes
|
||||
-------------------------
|
||||
|
||||
.. autoclass:: requests.PreparedRequest
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: requests.adapters.BaseAdapter
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: requests.adapters.HTTPAdapter
|
||||
:inherited-members:
|
||||
|
||||
Authentication
|
||||
--------------
|
||||
|
||||
.. autoclass:: requests.auth.AuthBase
|
||||
.. autoclass:: requests.auth.HTTPBasicAuth
|
||||
.. autoclass:: requests.auth.HTTPProxyAuth
|
||||
.. autoclass:: requests.auth.HTTPDigestAuth
|
||||
|
||||
|
||||
|
||||
Encodings
|
||||
---------
|
||||
|
||||
.. autofunction:: requests.utils.get_encodings_from_content
|
||||
.. autofunction:: requests.utils.get_encoding_from_headers
|
||||
.. autofunction:: requests.utils.get_unicode_from_response
|
||||
|
||||
|
||||
.. _api-cookies:
|
||||
|
||||
Cookies
|
||||
-------
|
||||
|
||||
.. autofunction:: requests.utils.dict_from_cookiejar
|
||||
.. autofunction:: requests.utils.add_dict_to_cookiejar
|
||||
.. autofunction:: requests.cookies.cookiejar_from_dict
|
||||
|
||||
.. autoclass:: requests.cookies.RequestsCookieJar
|
||||
:inherited-members:
|
||||
|
||||
.. autoclass:: requests.cookies.CookieConflictError
|
||||
:inherited-members:
|
||||
|
||||
|
||||
|
||||
Status Code Lookup
|
||||
------------------
|
||||
|
||||
.. autoclass:: requests.codes
|
||||
|
||||
::
|
||||
|
||||
>>> requests.codes['temporary_redirect']
|
||||
307
|
||||
|
||||
>>> requests.codes.teapot
|
||||
418
|
||||
|
||||
>>> requests.codes['\o/']
|
||||
200
|
||||
|
||||
|
||||
|
||||
Migrating to 1.x
|
||||
----------------
|
||||
|
||||
This section details the main differences between 0.x and 1.x and is meant
|
||||
to ease the pain of upgrading.
|
||||
|
||||
|
||||
API Changes
|
||||
~~~~~~~~~~~
|
||||
|
||||
* ``Response.json`` is now a callable and not a property of a response.
|
||||
|
||||
::
|
||||
|
||||
import requests
|
||||
r = requests.get('https://github.com/timeline.json')
|
||||
r.json() # This *call* raises an exception if JSON decoding fails
|
||||
|
||||
* The ``Session`` API has changed. Sessions objects no longer take parameters.
|
||||
``Session`` is also now capitalized, but it can still be
|
||||
instantiated with a lowercase ``session`` for backwards compatibility.
|
||||
|
||||
::
|
||||
|
||||
s = requests.Session() # formerly, session took parameters
|
||||
s.auth = auth
|
||||
s.headers.update(headers)
|
||||
r = s.get('http://httpbin.org/headers')
|
||||
|
||||
* All request hooks have been removed except 'response'.
|
||||
|
||||
* Authentication helpers have been broken out into separate modules. See
|
||||
requests-oauthlib_ and requests-kerberos_.
|
||||
|
||||
.. _requests-oauthlib: https://github.com/requests/requests-oauthlib
|
||||
.. _requests-kerberos: https://github.com/requests/requests-kerberos
|
||||
|
||||
* The parameter for streaming requests was changed from ``prefetch`` to
|
||||
``stream`` and the logic was inverted. In addition, ``stream`` is now
|
||||
required for raw response reading.
|
||||
|
||||
::
|
||||
|
||||
# in 0.x, passing prefetch=False would accomplish the same thing
|
||||
r = requests.get('https://github.com/timeline.json', stream=True)
|
||||
for chunk in r.iter_content(8192):
|
||||
...
|
||||
|
||||
* The ``config`` parameter to the requests method has been removed. Some of
|
||||
these options are now configured on a ``Session`` such as keep-alive and
|
||||
maximum number of redirects. The verbosity option should be handled by
|
||||
configuring logging.
|
||||
|
||||
::
|
||||
|
||||
import requests
|
||||
import logging
|
||||
|
||||
# Enabling debugging at http.client level (requests->urllib3->http.client)
|
||||
# you will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.
|
||||
# the only thing missing will be the response.body which is not logged.
|
||||
try: # for Python 3
|
||||
from http.client import HTTPConnection
|
||||
except ImportError:
|
||||
from httplib import HTTPConnection
|
||||
HTTPConnection.debuglevel = 1
|
||||
|
||||
logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
requests_log = logging.getLogger("requests.packages.urllib3")
|
||||
requests_log.setLevel(logging.DEBUG)
|
||||
requests_log.propagate = True
|
||||
|
||||
requests.get('http://httpbin.org/headers')
|
||||
|
||||
|
||||
|
||||
Licensing
|
||||
~~~~~~~~~
|
||||
|
||||
One key difference that has nothing to do with the API is a change in the
|
||||
license from the ISC_ license to the `Apache 2.0`_ license. The Apache 2.0
|
||||
license ensures that contributions to Requests are also covered by the Apache
|
||||
2.0 license.
|
||||
|
||||
.. _ISC: http://opensource.org/licenses/ISC
|
||||
.. _Apache 2.0: http://opensource.org/licenses/Apache-2.0
|
||||
|
||||
|
||||
Migrating to 2.x
|
||||
----------------
|
||||
|
||||
|
||||
Compared with the 1.0 release, there were relatively few backwards
|
||||
incompatible changes, but there are still a few issues to be aware of with
|
||||
this major release.
|
||||
|
||||
For more details on the changes in this release including new APIs, links
|
||||
to the relevant GitHub issues and some of the bug fixes, read Cory's blog_
|
||||
on the subject.
|
||||
|
||||
.. _blog: http://lukasa.co.uk/2013/09/Requests_20/
|
||||
|
||||
|
||||
API Changes
|
||||
~~~~~~~~~~~
|
||||
|
||||
* There were a couple changes to how Requests handles exceptions.
|
||||
``RequestException`` is now a subclass of ``IOError`` rather than
|
||||
``RuntimeError`` as that more accurately categorizes the type of error.
|
||||
In addition, an invalid URL escape sequence now raises a subclass of
|
||||
``RequestException`` rather than a ``ValueError``.
|
||||
|
||||
::
|
||||
|
||||
requests.get('http://%zz/') # raises requests.exceptions.InvalidURL
|
||||
|
||||
Lastly, ``httplib.IncompleteRead`` exceptions caused by incorrect chunked
|
||||
encoding will now raise a Requests ``ChunkedEncodingError`` instead.
|
||||
|
||||
* The proxy API has changed slightly. The scheme for a proxy URL is now
|
||||
required.
|
||||
|
||||
::
|
||||
|
||||
proxies = {
|
||||
"http": "10.10.1.10:3128", # use http://10.10.1.10:3128 instead
|
||||
}
|
||||
|
||||
# In requests 1.x, this was legal, in requests 2.x,
|
||||
# this raises requests.exceptions.MissingSchema
|
||||
requests.get("http://example.org", proxies=proxies)
|
||||
|
||||
|
||||
Behavioural Changes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Keys in the ``headers`` dictionary are now native strings on all Python
|
||||
versions, i.e. bytestrings on Python 2 and unicode on Python 3. If the
|
||||
keys are not native strings (unicode on Python 2 or bytestrings on Python 3)
|
||||
they will be converted to the native string type assuming UTF-8 encoding.
|
||||
|
||||
* Values in the ``headers`` dictionary should always be strings. This has
|
||||
been the project's position since before 1.0 but a recent change
|
||||
(since version 2.11.0) enforces this more strictly. It's advised to avoid
|
||||
passing header values as unicode when possible.
|
||||
86
docs/community/faq.rst
Normal file
86
docs/community/faq.rst
Normal file
@@ -0,0 +1,86 @@
|
||||
.. _faq:
|
||||
|
||||
Frequently Asked Questions
|
||||
==========================
|
||||
|
||||
This part of the documentation answers common questions about Requests.
|
||||
|
||||
Encoded Data?
|
||||
-------------
|
||||
|
||||
Requests automatically decompresses gzip-encoded responses, and does
|
||||
its best to decode response content to unicode when possible.
|
||||
|
||||
You can get direct access to the raw response (and even the socket),
|
||||
if needed as well.
|
||||
|
||||
|
||||
Custom User-Agents?
|
||||
-------------------
|
||||
|
||||
Requests allows you to easily override User-Agent strings, along with
|
||||
any other HTTP Header.
|
||||
|
||||
|
||||
Why not Httplib2?
|
||||
-----------------
|
||||
|
||||
Chris Adams gave an excellent summary on
|
||||
`Hacker News <http://news.ycombinator.com/item?id=2884406>`_:
|
||||
|
||||
httplib2 is part of why you should use requests: it's far more respectable
|
||||
as a client but not as well documented and it still takes way too much code
|
||||
for basic operations. I appreciate what httplib2 is trying to do, that
|
||||
there's a ton of hard low-level annoyances in building a modern HTTP
|
||||
client, but really, just use requests instead. Kenneth Reitz is very
|
||||
motivated and he gets the degree to which simple things should be simple
|
||||
whereas httplib2 feels more like an academic exercise than something
|
||||
people should use to build production systems[1].
|
||||
|
||||
Disclosure: I'm listed in the requests AUTHORS file but can claim credit
|
||||
for, oh, about 0.0001% of the awesomeness.
|
||||
|
||||
1. http://code.google.com/p/httplib2/issues/detail?id=96 is a good example:
|
||||
an annoying bug which affect many people, there was a fix available for
|
||||
months, which worked great when I applied it in a fork and pounded a couple
|
||||
TB of data through it, but it took over a year to make it into trunk and
|
||||
even longer to make it onto PyPI where any other project which required "
|
||||
httplib2" would get the working version.
|
||||
|
||||
|
||||
Python 3 Support?
|
||||
-----------------
|
||||
|
||||
Yes! Here's a list of Python platforms that are officially
|
||||
supported:
|
||||
|
||||
* Python 2.6
|
||||
* Python 2.7
|
||||
* Python 3.4
|
||||
* Python 3.5
|
||||
* Python 3.6
|
||||
* PyPy
|
||||
|
||||
What are "hostname doesn't match" errors?
|
||||
-----------------------------------------
|
||||
|
||||
These errors occur when :ref:`SSL certificate verification <verification>`
|
||||
fails to match the certificate the server responds with to the hostname
|
||||
Requests thinks it's contacting. If you're certain the server's SSL setup is
|
||||
correct (for example, because you can visit the site with your browser) and
|
||||
you're using Python 2.6 or 2.7, a possible explanation is that you need
|
||||
Server-Name-Indication.
|
||||
|
||||
`Server-Name-Indication`_, or SNI, is an official extension to SSL where the
|
||||
client tells the server what hostname it is contacting. This is important
|
||||
when servers are using `Virtual Hosting`_. When such servers are hosting
|
||||
more than one SSL site they need to be able to return the appropriate
|
||||
certificate based on the hostname the client is connecting to.
|
||||
|
||||
Python3 and Python 2.7.9+ include native support for SNI in their SSL modules.
|
||||
For information on using SNI with Requests on Python < 2.7.9 refer to this
|
||||
`Stack Overflow answer`_.
|
||||
|
||||
.. _`Server-Name-Indication`: https://en.wikipedia.org/wiki/Server_Name_Indication
|
||||
.. _`virtual hosting`: https://en.wikipedia.org/wiki/Virtual_hosting
|
||||
.. _`Stack Overflow answer`: https://stackoverflow.com/questions/18578439/using-requests-with-tls-doesnt-give-sni-support/18579484#18579484
|
||||
22
docs/community/out-there.rst
Normal file
22
docs/community/out-there.rst
Normal file
@@ -0,0 +1,22 @@
|
||||
Integrations
|
||||
============
|
||||
|
||||
Python for iOS
|
||||
--------------
|
||||
|
||||
Requests is built into the wonderful `Python for iOS <https://itunes.apple.com/us/app/python-2.7-for-ios/id485729872?mt=Python8>`_ runtime!
|
||||
|
||||
To give it a try, simply::
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
Articles & Talks
|
||||
================
|
||||
- `Python for the Web <http://gun.io/blog/python-for-the-web/>`_ teaches how to use Python to interact with the web, using Requests.
|
||||
- `Daniel Greenfeld's Review of Requests <http://pydanny.blogspot.com/2011/05/python-http-requests-for-humans.html>`_
|
||||
- `My 'Python for Humans' talk <http://python-for-humans.heroku.com>`_ ( `audio <http://codeconf.s3.amazonaws.com/2011/pycodeconf/talks/PyCodeConf2011%20-%20Kenneth%20Reitz.m4a>`_ )
|
||||
- `Issac Kelly's 'Consuming Web APIs' talk <http://issackelly.github.com/Consuming-Web-APIs-with-Python-Talk/slides/slides.html>`_
|
||||
- `Blog post about Requests via Yum <http://arunsag.wordpress.com/2011/08/17/new-package-python-requests-http-for-humans/>`_
|
||||
- `Russian blog post introducing Requests <http://habrahabr.ru/blogs/python/126262/>`_
|
||||
- `Sending JSON in Requests <http://www.coglib.com/~icordasc/blog/2014/11/sending-json-in-requests.html>`_
|
||||
57
docs/community/recommended.rst
Normal file
57
docs/community/recommended.rst
Normal file
@@ -0,0 +1,57 @@
|
||||
.. _recommended:
|
||||
|
||||
Recommended Packages and Extensions
|
||||
===================================
|
||||
|
||||
Requests has a great variety of powerful and useful third-party extensions.
|
||||
This page provides an overview of some of the best of them.
|
||||
|
||||
Certifi CA Bundle
|
||||
-----------------
|
||||
|
||||
`Certifi`_ is a carefully curated collection of Root Certificates for
|
||||
validating the trustworthiness of SSL certificates while verifying the
|
||||
identity of TLS hosts. It has been extracted from the Requests project.
|
||||
|
||||
.. _Certifi: http://certifi.io/en/latest/
|
||||
|
||||
CacheControl
|
||||
------------
|
||||
|
||||
`CacheControl`_ is an extension that adds a full HTTP cache to Requests. This
|
||||
makes your web requests substantially more efficient, and should be used
|
||||
whenever you're making a lot of web requests.
|
||||
|
||||
.. _CacheControl: https://cachecontrol.readthedocs.io/en/latest/
|
||||
|
||||
Requests-Toolbelt
|
||||
-----------------
|
||||
|
||||
`Requests-Toolbelt`_ is a collection of utilities that some users of Requests may desire,
|
||||
but do not belong in Requests proper. This library is actively maintained
|
||||
by members of the Requests core team, and reflects the functionality most
|
||||
requested by users within the community.
|
||||
|
||||
.. _Requests-Toolbelt: http://toolbelt.readthedocs.io/en/latest/index.html
|
||||
|
||||
Requests-OAuthlib
|
||||
-----------------
|
||||
|
||||
`requests-oauthlib`_ makes it possible to do the OAuth dance from Requests
|
||||
automatically. This is useful for the large number of websites that use OAuth
|
||||
to provide authentication. It also provides a lot of tweaks that handle ways
|
||||
that specific OAuth providers differ from the standard specifications.
|
||||
|
||||
.. _requests-oauthlib: https://requests-oauthlib.readthedocs.io/en/latest/
|
||||
|
||||
|
||||
Betamax
|
||||
-------
|
||||
|
||||
`Betamax`_ records your HTTP interactions so the NSA does not have to.
|
||||
A VCR imitation designed only for Python-Requests.
|
||||
|
||||
.. _betamax: https://github.com/sigmavirus24/betamax
|
||||
|
||||
|
||||
|
||||
54
docs/community/release-process.rst
Normal file
54
docs/community/release-process.rst
Normal file
@@ -0,0 +1,54 @@
|
||||
Release Process and Rules
|
||||
=========================
|
||||
|
||||
.. versionadded:: v2.6.2
|
||||
|
||||
Starting with the version to be released after ``v2.6.2``, the following rules
|
||||
will govern and describe how the Requests core team produces a new release.
|
||||
|
||||
Major Releases
|
||||
--------------
|
||||
|
||||
A major release will include breaking changes. When it is versioned, it will
|
||||
be versioned as ``vX.0.0``. For example, if the previous release was
|
||||
``v10.2.7`` the next version will be ``v11.0.0``.
|
||||
|
||||
Breaking changes are changes that break backwards compatibility with prior
|
||||
versions. If the project were to change the ``text`` attribute on a
|
||||
``Response`` object to a method, that would only happen in a Major release.
|
||||
|
||||
Major releases may also include miscellaneous bug fixes and upgrades to
|
||||
vendored packages. The core developers of Requests are committed to providing
|
||||
a good user experience. This means we're also committed to preserving
|
||||
backwards compatibility as much as possible. Major releases will be infrequent
|
||||
and will need strong justifications before they are considered.
|
||||
|
||||
Minor Releases
|
||||
--------------
|
||||
|
||||
A minor release will not include breaking changes but may include
|
||||
miscellaneous bug fixes and upgrades to vendored packages. If the previous
|
||||
version of Requests released was ``v10.2.7`` a minor release would be
|
||||
versioned as ``v10.3.0``.
|
||||
|
||||
Minor releases will be backwards compatible with releases that have the same
|
||||
major version number. In other words, all versions that would start with
|
||||
``v10.`` should be compatible with each other.
|
||||
|
||||
Hotfix Releases
|
||||
---------------
|
||||
|
||||
A hotfix release will only include bug fixes that were missed when the project
|
||||
released the previous version. If the previous version of Requests released
|
||||
``v10.2.7`` the hotfix release would be versioned as ``v10.2.8``.
|
||||
|
||||
Hotfixes will **not** include upgrades to vendored dependencies after
|
||||
``v2.6.2``
|
||||
|
||||
Reasoning
|
||||
---------
|
||||
|
||||
In the 2.5 and 2.6 release series, the Requests core team upgraded vendored
|
||||
dependencies and caused a great deal of headaches for both users and the core
|
||||
team. To reduce this pain, we're forming a concrete set of procedures so
|
||||
expectations will be properly set.
|
||||
51
docs/community/support.rst
Normal file
51
docs/community/support.rst
Normal file
@@ -0,0 +1,51 @@
|
||||
.. _support:
|
||||
|
||||
Support
|
||||
=======
|
||||
|
||||
If you have questions or issues about Requests, there are several options:
|
||||
|
||||
StackOverflow
|
||||
-------------
|
||||
|
||||
If your question does not contain sensitive (possibly proprietary)
|
||||
information or can be properly anonymized, please ask a question on
|
||||
`StackOverflow <https://stackoverflow.com/questions/tagged/python-requests>`_
|
||||
and use the tag ``python-requests``.
|
||||
|
||||
Send a Tweet
|
||||
------------
|
||||
|
||||
If your question is less than 140 characters, feel free to send a tweet to
|
||||
`@kennethreitz <https://twitter.com/kennethreitz>`_,
|
||||
`@sigmavirus24 <https://twitter.com/sigmavirus24>`_, or
|
||||
`@lukasaoz <https://twitter.com/lukasaoz>`_.
|
||||
|
||||
File an Issue
|
||||
-------------
|
||||
|
||||
If you notice some unexpected behaviour in Requests, or want to see support
|
||||
for a new feature,
|
||||
`file an issue on GitHub <https://github.com/requests/requests/issues>`_.
|
||||
|
||||
|
||||
E-mail
|
||||
------
|
||||
|
||||
I'm more than happy to answer any personal or in-depth questions about
|
||||
Requests. Feel free to email
|
||||
`requests@kennethreitz.com <mailto:requests@kennethreitz.com>`_.
|
||||
|
||||
|
||||
IRC
|
||||
---
|
||||
|
||||
The official Freenode channel for Requests is
|
||||
`#python-requests <irc://irc.freenode.net/python-requests>`_
|
||||
|
||||
The core developers of requests are on IRC throughout the day.
|
||||
You can find them in ``#python-requests`` as:
|
||||
|
||||
- kennethreitz
|
||||
- lukasa
|
||||
- sigmavirus24
|
||||
30
docs/community/updates.rst
Normal file
30
docs/community/updates.rst
Normal file
@@ -0,0 +1,30 @@
|
||||
.. _updates:
|
||||
|
||||
|
||||
Community Updates
|
||||
=================
|
||||
|
||||
If you'd like to stay up to date on the community and development of Requests,
|
||||
there are several options:
|
||||
|
||||
|
||||
GitHub
|
||||
------
|
||||
|
||||
The best way to track the development of Requests is through
|
||||
`the GitHub repo <https://github.com/requests/requests>`_.
|
||||
|
||||
Twitter
|
||||
-------
|
||||
|
||||
The author, Kenneth Reitz, often tweets about new features and releases of Requests.
|
||||
|
||||
Follow `@kennethreitz <https://twitter.com/kennethreitz>`_ for updates.
|
||||
|
||||
|
||||
|
||||
Release and Version History
|
||||
===========================
|
||||
|
||||
.. include:: ../../HISTORY.rst
|
||||
|
||||
105
docs/community/vulnerabilities.rst
Normal file
105
docs/community/vulnerabilities.rst
Normal file
@@ -0,0 +1,105 @@
|
||||
Vulnerability Disclosure
|
||||
========================
|
||||
|
||||
If you think you have found a potential security vulnerability in requests,
|
||||
please email `sigmavirus24 <mailto:graffatcolmingov@gmail.com>`_ and
|
||||
`Lukasa <mailto:cory@lukasa.co.uk>`_ directly. **Do not file a public issue.**
|
||||
|
||||
Our PGP Key fingerprints are:
|
||||
|
||||
- 0161 BB7E B208 B5E0 4FDC 9F81 D9DA 0A04 9113 F853 (@sigmavirus24)
|
||||
|
||||
- 90DC AE40 FEA7 4B14 9B70 662D F25F 2144 EEC1 373D (@lukasa)
|
||||
|
||||
If English is not your first language, please try to describe the problem and
|
||||
its impact to the best of your ability. For greater detail, please use your
|
||||
native language and we will try our best to translate it using online services.
|
||||
|
||||
Please also include the code you used to find the problem and the shortest
|
||||
amount of code necessary to reproduce it.
|
||||
|
||||
Please do not disclose this to anyone else. We will retrieve a CVE identifier
|
||||
if necessary and give you full credit under whatever name or alias you provide.
|
||||
We will only request an identifier when we have a fix and can publish it in a
|
||||
release.
|
||||
|
||||
We will respect your privacy and will only publicize your involvement if you
|
||||
grant us permission.
|
||||
|
||||
Process
|
||||
-------
|
||||
|
||||
This following information discusses the process the requests project follows
|
||||
in response to vulnerability disclosures. If you are disclosing a
|
||||
vulnerability, this section of the documentation lets you know how we will
|
||||
respond to your disclosure.
|
||||
|
||||
Timeline
|
||||
~~~~~~~~
|
||||
|
||||
When you report an issue, one of the project members will respond to you within
|
||||
two days *at the outside*. In most cases responses will be faster, usually
|
||||
within 12 hours. This initial response will at the very least confirm receipt
|
||||
of the report.
|
||||
|
||||
If we were able to rapidly reproduce the issue, the initial response will also
|
||||
contain confirmation of the issue. If we are not, we will often ask for more
|
||||
information about the reproduction scenario.
|
||||
|
||||
Our goal is to have a fix for any vulnerability released within two weeks of
|
||||
the initial disclosure. This may potentially involve shipping an interim
|
||||
release that simply disables function while a more mature fix can be prepared,
|
||||
but will in the vast majority of cases mean shipping a complete release as soon
|
||||
as possible.
|
||||
|
||||
Throughout the fix process we will keep you up to speed with how the fix is
|
||||
progressing. Once the fix is prepared, we will notify you that we believe we
|
||||
have a fix. Often we will ask you to confirm the fix resolves the problem in
|
||||
your environment, especially if we are not confident of our reproduction
|
||||
scenario.
|
||||
|
||||
At this point, we will prepare for the release. We will obtain a CVE number
|
||||
if one is required, providing you with full credit for the discovery. We will
|
||||
also decide on a planned release date, and let you know when it is. This
|
||||
release date will *always* be on a weekday.
|
||||
|
||||
At this point we will reach out to our major downstream packagers to notify
|
||||
them of an impending security-related patch so they can make arrangements. In
|
||||
addition, these packagers will be provided with the intended patch ahead of
|
||||
time, to ensure that they are able to promptly release their downstream
|
||||
packages. Currently the list of people we actively contact *ahead of a public
|
||||
release* is:
|
||||
|
||||
- Jeremy Cline, Red Hat (@jeremycline)
|
||||
- Daniele Tricoli, Debian (@eriol)
|
||||
|
||||
We will notify these individuals at least a week ahead of our planned release
|
||||
date to ensure that they have sufficient time to prepare. If you believe you
|
||||
should be on this list, please let one of the maintainers know at one of the
|
||||
email addresses at the top of this article.
|
||||
|
||||
On release day, we will push the patch to our public repository, along with an
|
||||
updated changelog that describes the issue and credits you. We will then issue
|
||||
a PyPI release containing the patch.
|
||||
|
||||
At this point, we will publicise the release. This will involve mails to
|
||||
mailing lists, Tweets, and all other communication mechanisms available to the
|
||||
core team.
|
||||
|
||||
We will also explicitly mention which commits contain the fix to make it easier
|
||||
for other distributors and users to easily patch their own versions of requests
|
||||
if upgrading is not an option.
|
||||
|
||||
Previous CVEs
|
||||
-------------
|
||||
|
||||
- Fixed in 2.6.0
|
||||
|
||||
- `CVE 2015-2296 <http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2015-2296>`_,
|
||||
reported by Matthew Daley of `BugFuzz <https://bugfuzz.com/>`_.
|
||||
|
||||
- Fixed in 2.3.0
|
||||
|
||||
- `CVE 2014-1829 <http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2014-1829>`_
|
||||
|
||||
- `CVE 2014-1830 <http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2014-1830>`_
|
||||
230
docs/conf.py
230
docs/conf.py
@@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Requests documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sun Feb 13 23:54:25 2011.
|
||||
# sphinx-quickstart on Fri Feb 19 00:05:47 2016.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
@@ -11,26 +12,42 @@
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
# Insert Requests' path into the system.
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
sys.path.insert(0, os.path.abspath('_themes'))
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.jsmath', 'sphinx.ext.viewcode']
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.todo',
|
||||
'sphinx.ext.viewcode',
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
# source_suffix = ['.rst', '.md']
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
@@ -41,20 +58,24 @@ master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'Requests'
|
||||
copyright = u'2011, Kenneth Reitz'
|
||||
copyright = u'MMXVII. A <a href="http://kennethreitz.com/pages/open-projects.html">Kenneth Reitz</a> Project'
|
||||
author = u'Kenneth Reitz'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.2.0'
|
||||
version = requests.__version__
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.2.0'
|
||||
release = requests.__version__
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
@@ -66,37 +87,50 @@ release = '0.2.0'
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
add_function_parentheses = False
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
pygments_style = 'flask_theme_support.FlaskyStyle'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = True
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'default'
|
||||
html_theme = 'alabaster'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
html_theme_options = {
|
||||
'show_powered_by': False,
|
||||
'github_user': 'requests',
|
||||
'github_repo': 'requests',
|
||||
'github_banner': True,
|
||||
'show_related': False
|
||||
}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
@@ -122,16 +156,26 @@ html_theme = 'default'
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# Add any extra paths that contain custom files (such as robots.txt or
|
||||
# .htaccess) here, relative to this directory. These files are copied
|
||||
# directly to the root of the documentation.
|
||||
#html_extra_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
html_use_smartypants = False
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
html_sidebars = {
|
||||
'index': ['sidebarintro.html', 'sourcelink.html', 'searchbox.html',
|
||||
'hacks.html'],
|
||||
'**': ['sidebarlogo.html', 'localtoc.html', 'relations.html',
|
||||
'sourcelink.html', 'searchbox.html', 'hacks.html']
|
||||
}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
@@ -147,13 +191,13 @@ html_static_path = ['_static']
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
html_show_sourcelink = False
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
html_show_sphinx = False
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
@@ -163,23 +207,45 @@ html_static_path = ['_static']
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Language to be used for generating the HTML full-text search index.
|
||||
# Sphinx supports the following languages:
|
||||
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
|
||||
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
|
||||
#html_search_language = 'en'
|
||||
|
||||
# A dictionary with options for the search language support, empty by default.
|
||||
# Now only 'ja' uses this config value
|
||||
#html_search_options = {'type': 'default'}
|
||||
|
||||
# The name of a javascript file (relative to the configuration directory) that
|
||||
# implements a search results scorer. If empty, the default will be used.
|
||||
#html_search_scorer = 'scorer.js'
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'Requestsdoc'
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
|
||||
# The paper size ('letter' or 'a4').
|
||||
#latex_paper_size = 'letter'
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#latex_font_size = '10pt'
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'Requests.tex', u'Requests Documentation',
|
||||
u'Kenneth Reitz', 'manual'),
|
||||
(master_doc, 'Requests.tex', u'Requests Documentation',
|
||||
u'Kenneth Reitz', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
@@ -196,9 +262,6 @@ latex_documents = [
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#latex_preamble = ''
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
@@ -206,27 +269,110 @@ latex_documents = [
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output --------------------------------------------
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'requests', u'Requests Documentation',
|
||||
[u'Kenneth Reitz'], 1)
|
||||
(master_doc, 'requests', u'Requests Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
# -- Options for Texinfo output ------------------------------------------------
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'Requests', u'Requests Documentation', u'Kenneth Reitz',
|
||||
'Requests', 'One line description of project.', 'Miscellaneous'),
|
||||
(master_doc, 'Requests', u'Requests Documentation',
|
||||
author, 'Requests', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
texinfo_appendices = []
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
||||
|
||||
|
||||
# -- Options for Epub output ----------------------------------------------
|
||||
|
||||
# Bibliographic Dublin Core info.
|
||||
epub_title = project
|
||||
epub_author = author
|
||||
epub_publisher = author
|
||||
epub_copyright = copyright
|
||||
|
||||
# The basename for the epub file. It defaults to the project name.
|
||||
#epub_basename = project
|
||||
|
||||
# The HTML theme for the epub output. Since the default themes are not
|
||||
# optimized for small screen space, using the same theme for HTML and epub
|
||||
# output is usually not wise. This defaults to 'epub', a theme designed to save
|
||||
# visual space.
|
||||
#epub_theme = 'epub'
|
||||
|
||||
# The language of the text. It defaults to the language option
|
||||
# or 'en' if the language is not set.
|
||||
#epub_language = ''
|
||||
|
||||
# The scheme of the identifier. Typical schemes are ISBN or URL.
|
||||
#epub_scheme = ''
|
||||
|
||||
# The unique identifier of the text. This can be a ISBN number
|
||||
# or the project homepage.
|
||||
#epub_identifier = ''
|
||||
|
||||
# A unique identification for the text.
|
||||
#epub_uid = ''
|
||||
|
||||
# A tuple containing the cover image and cover page html template filenames.
|
||||
#epub_cover = ()
|
||||
|
||||
# A sequence of (type, uri, title) tuples for the guide element of content.opf.
|
||||
#epub_guide = ()
|
||||
|
||||
# HTML files that should be inserted before the pages created by sphinx.
|
||||
# The format is a list of tuples containing the path and title.
|
||||
#epub_pre_files = []
|
||||
|
||||
# HTML files that should be inserted after the pages created by sphinx.
|
||||
# The format is a list of tuples containing the path and title.
|
||||
#epub_post_files = []
|
||||
|
||||
# A list of files that should not be packed into the epub file.
|
||||
epub_exclude_files = ['search.html']
|
||||
|
||||
# The depth of the table of contents in toc.ncx.
|
||||
#epub_tocdepth = 3
|
||||
|
||||
# Allow duplicate toc entries.
|
||||
#epub_tocdup = True
|
||||
|
||||
# Choose between 'default' and 'includehidden'.
|
||||
#epub_tocscope = 'default'
|
||||
|
||||
# Fix unsupported image types using the Pillow.
|
||||
#epub_fix_images = False
|
||||
|
||||
# Scale large images.
|
||||
#epub_max_image_width = 0
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#epub_show_urls = 'inline'
|
||||
|
||||
# If false, no index is generated.
|
||||
#epub_use_index = True
|
||||
|
||||
intersphinx_mapping = {'urllib3': ('http://urllib3.readthedocs.io/en/latest', None)}
|
||||
|
||||
5
docs/dev/authors.rst
Normal file
5
docs/dev/authors.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
Authors
|
||||
=======
|
||||
|
||||
|
||||
.. include:: ../../AUTHORS.rst
|
||||
206
docs/dev/contributing.rst
Normal file
206
docs/dev/contributing.rst
Normal file
@@ -0,0 +1,206 @@
|
||||
.. _contributing:
|
||||
|
||||
Contributor's Guide
|
||||
===================
|
||||
|
||||
If you're reading this, you're probably interested in contributing to Requests.
|
||||
Thank you very much! Open source projects live-and-die based on the support
|
||||
they receive from others, and the fact that you're even considering
|
||||
contributing to the Requests project is *very* generous of you.
|
||||
|
||||
This document lays out guidelines and advice for contributing to this project.
|
||||
If you're thinking of contributing, please start by reading this document and
|
||||
getting a feel for how contributing to this project works. If you have any
|
||||
questions, feel free to reach out to either `Ian Cordasco`_ or `Cory Benfield`_,
|
||||
the primary maintainers.
|
||||
|
||||
.. _Ian Cordasco: http://www.coglib.com/~icordasc/
|
||||
.. _Cory Benfield: https://lukasa.co.uk/about
|
||||
|
||||
If you have non-technical feedback, philosophical ponderings, crazy ideas, or
|
||||
other general thoughts about Requests or its position within the Python
|
||||
ecosystem, the BDFL, `Kenneth Reitz`_, would love to hear from you.
|
||||
|
||||
The guide is split into sections based on the type of contribution you're
|
||||
thinking of making, with a section that covers general guidelines for all
|
||||
contributors.
|
||||
|
||||
.. _Kenneth Reitz: mailto:me@kennethreitz.org
|
||||
|
||||
Be Cordial
|
||||
----------
|
||||
|
||||
**Be cordial or be on your way**. *—Kenneth Reitz*
|
||||
|
||||
Requests has one very important rule governing all forms of contribution,
|
||||
including reporting bugs or requesting features. This golden rule is
|
||||
"`be cordial or be on your way`_".
|
||||
|
||||
**All contributions are welcome**, as long as
|
||||
everyone involved is treated with respect.
|
||||
|
||||
.. _be cordial or be on your way: http://kennethreitz.org/be-cordial-or-be-on-your-way/
|
||||
|
||||
.. _early-feedback:
|
||||
|
||||
Get Early Feedback
|
||||
------------------
|
||||
|
||||
If you are contributing, do not feel the need to sit on your contribution until
|
||||
it is perfectly polished and complete. It helps everyone involved for you to
|
||||
seek feedback as early as you possibly can. Submitting an early, unfinished
|
||||
version of your contribution for feedback in no way prejudices your chances of
|
||||
getting that contribution accepted, and can save you from putting a lot of work
|
||||
into a contribution that is not suitable for the project.
|
||||
|
||||
Contribution Suitability
|
||||
------------------------
|
||||
|
||||
Our project maintainers have the last word on whether or not a contribution is
|
||||
suitable for Requests. All contributions will be considered carefully, but from
|
||||
time to time, contributions will be rejected because they do not suit the
|
||||
current goals or needs of the project.
|
||||
|
||||
If your contribution is rejected, don't despair! As long as you followed these
|
||||
guidelines, you will have a much better chance of getting your next
|
||||
contribution accepted.
|
||||
|
||||
|
||||
Code Contributions
|
||||
------------------
|
||||
|
||||
Steps for Submitting Code
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
When contributing code, you'll want to follow this checklist:
|
||||
|
||||
1. Fork the repository on GitHub.
|
||||
2. Run the tests to confirm they all pass on your system. If they don't, you'll
|
||||
need to investigate why they fail. If you're unable to diagnose this
|
||||
yourself, raise it as a bug report by following the guidelines in this
|
||||
document: :ref:`bug-reports`.
|
||||
3. Write tests that demonstrate your bug or feature. Ensure that they fail.
|
||||
4. Make your change.
|
||||
5. Run the entire test suite again, confirming that all tests pass *including
|
||||
the ones you just added*.
|
||||
6. Send a GitHub Pull Request to the main repository's ``master`` branch.
|
||||
GitHub Pull Requests are the expected method of code collaboration on this
|
||||
project.
|
||||
|
||||
The following sub-sections go into more detail on some of the points above.
|
||||
|
||||
Code Review
|
||||
~~~~~~~~~~~
|
||||
|
||||
Contributions will not be merged until they've been code reviewed. You should
|
||||
implement any code review feedback unless you strongly object to it. In the
|
||||
event that you object to the code review feedback, you should make your case
|
||||
clearly and calmly. If, after doing so, the feedback is judged to still apply,
|
||||
you must either apply the feedback or withdraw your contribution.
|
||||
|
||||
New Contributors
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
If you are new or relatively new to Open Source, welcome! Requests aims to
|
||||
be a gentle introduction to the world of Open Source. If you're concerned about
|
||||
how best to contribute, please consider mailing a maintainer (listed above) and
|
||||
asking for help.
|
||||
|
||||
Please also check the :ref:`early-feedback` section.
|
||||
|
||||
Kenneth Reitz's Code Style™
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The Requests codebase uses the `PEP 8`_ code style.
|
||||
|
||||
In addition to the standards outlined in PEP 8, we have a few guidelines:
|
||||
|
||||
- Line-length can exceed 79 characters, to 100, when convenient.
|
||||
- Line-length can exceed 100 characters, when doing otherwise would be *terribly* inconvenient.
|
||||
- Always use single-quoted strings (e.g. ``'#flatearth'``), unless a single-quote occurs within the string.
|
||||
|
||||
Additionally, one of the styles that PEP8 recommends for `line continuations`_
|
||||
completely lacks all sense of taste, and is not to be permitted within
|
||||
the Requests codebase::
|
||||
|
||||
# Aligned with opening delimiter.
|
||||
foo = long_function_name(var_one, var_two,
|
||||
var_three, var_four)
|
||||
|
||||
No. Just don't. Please.
|
||||
|
||||
Docstrings are to follow the following syntaxes::
|
||||
|
||||
def the_earth_is_flat():
|
||||
"""NASA divided up the seas into thirty-three degrees."""
|
||||
pass
|
||||
|
||||
::
|
||||
|
||||
def fibonacci_spiral_tool():
|
||||
"""With my feet upon the ground I lose myself / between the sounds
|
||||
and open wide to suck it in. / I feel it move across my skin. / I'm
|
||||
reaching up and reaching out. / I'm reaching for the random or
|
||||
whatever will bewilder me. / Whatever will bewilder me. / And
|
||||
following our will and wind we may just go where no one's been. /
|
||||
We'll ride the spiral to the end and may just go where no one's
|
||||
been.
|
||||
|
||||
Spiral out. Keep going...
|
||||
"""
|
||||
pass
|
||||
|
||||
All functions, methods, and classes are to contain docstrings. Object data
|
||||
model methods (e.g. ``__repr__``) are typically the exception to this rule.
|
||||
|
||||
Thanks for helping to make the world a better place!
|
||||
|
||||
.. _PEP 8: http://pep8.org
|
||||
.. _line continuations: https://www.python.org/dev/peps/pep-0008/#indentation
|
||||
|
||||
Documentation Contributions
|
||||
---------------------------
|
||||
|
||||
Documentation improvements are always welcome! The documentation files live in
|
||||
the ``docs/`` directory of the codebase. They're written in
|
||||
`reStructuredText`_, and use `Sphinx`_ to generate the full suite of
|
||||
documentation.
|
||||
|
||||
When contributing documentation, please do your best to follow the style of the
|
||||
documentation files. This means a soft-limit of 79 characters wide in your text
|
||||
files and a semi-formal, yet friendly and approachable, prose style.
|
||||
|
||||
When presenting Python code, use single-quoted strings (``'hello'`` instead of
|
||||
``"hello"``).
|
||||
|
||||
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
|
||||
.. _Sphinx: http://sphinx-doc.org/index.html
|
||||
|
||||
|
||||
.. _bug-reports:
|
||||
|
||||
Bug Reports
|
||||
-----------
|
||||
|
||||
Bug reports are hugely important! Before you raise one, though, please check
|
||||
through the `GitHub issues`_, **both open and closed**, to confirm that the bug
|
||||
hasn't been reported before. Duplicate bug reports are a huge drain on the time
|
||||
of other contributors, and should be avoided as much as possible.
|
||||
|
||||
.. _GitHub issues: https://github.com/requests/requests/issues
|
||||
|
||||
|
||||
Feature Requests
|
||||
----------------
|
||||
|
||||
Requests is in a perpetual feature freeze, only the BDFL can add or approve of
|
||||
new features. The maintainers believe that Requests is a feature-complete
|
||||
piece of software at this time.
|
||||
|
||||
One of the most important skills to have while maintaining a largely-used
|
||||
open source project is learning the ability to say "no" to suggested changes,
|
||||
while keeping an open ear and mind.
|
||||
|
||||
If you believe there is a feature missing, feel free to raise a feature
|
||||
request, but please do be aware that the overwhelming likelihood is that your
|
||||
feature request will not be accepted.
|
||||
41
docs/dev/philosophy.rst
Normal file
41
docs/dev/philosophy.rst
Normal file
@@ -0,0 +1,41 @@
|
||||
Development Philosophy
|
||||
======================
|
||||
|
||||
Requests is an open but opinionated library, created by an open but opinionated developer.
|
||||
|
||||
|
||||
Management Style
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
`Kenneth Reitz <http://kennethreitz.org>`_ is the BDFL. He has final say in any decision related to the Requests project. Kenneth is responsible for the direction and form of the library, as well as its presentation. In addition to making decisions based on technical merit, he is responsible for making decisions based on the development philosophy of Requests.
|
||||
|
||||
`Ian Cordasco <http://www.coglib.com/~icordasc/>`_ and `Cory Benfield <https://lukasa.co.uk/about/>`_ are the core contributors. They are responsible for triaging bug reports, reviewing pull requests and ensuring that Kenneth is kept up to speed with developments around the library. The day-to-day managing of the project is done by the core contributors. They are responsible for making judgements about whether or not a feature request is likely to be accepted by Kenneth. Their word is, in some ways, more final than Kenneth's.
|
||||
|
||||
Values
|
||||
~~~~~~
|
||||
|
||||
- Simplicity is always better than functionality.
|
||||
- Listen to everyone, then disregard it.
|
||||
- The API is all that matters. Everything else is secondary.
|
||||
- Fit the 90% use-case. Ignore the nay-sayers.
|
||||
|
||||
Semantic Versioning
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For many years, the open source community has been plagued with version number dystonia. Numbers vary so greatly from project to project, they are practically meaningless.
|
||||
|
||||
Requests uses `Semantic Versioning <http://semver.org>`_. This specification seeks to put an end to this madness with a small set of practical guidelines for you and your colleagues to use in your next project.
|
||||
|
||||
Standard Library?
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Requests has no *active* plans to be included in the standard library. This decision has been discussed at length with Guido as well as numerous core developers.
|
||||
|
||||
Essentially, the standard library is where a library goes to die. It is appropriate for a module to be included when active development is no longer necessary.
|
||||
|
||||
Linux Distro Packages
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Distributions have been made for many Linux repositories, including: Ubuntu, Debian, RHEL, and Arch.
|
||||
|
||||
These distributions are sometimes divergent forks, or are otherwise not kept up-to-date with the latest code and bugfixes. PyPI (and its mirrors) and GitHub are the official distribution sources; alternatives are not supported by the Requests project.
|
||||
63
docs/dev/todo.rst
Normal file
63
docs/dev/todo.rst
Normal file
@@ -0,0 +1,63 @@
|
||||
How to Help
|
||||
===========
|
||||
|
||||
Requests is under active development, and contributions are more than welcome!
|
||||
|
||||
#. Check for open issues or open a fresh issue to start a discussion around a bug.
|
||||
There is a Contributor Friendly tag for issues that should be ideal for people who are not very
|
||||
familiar with the codebase yet.
|
||||
#. Fork `the repository <https://github.com/requests/requests>`_ on GitHub and start making your
|
||||
changes to a new branch.
|
||||
#. Write a test which shows that the bug was fixed.
|
||||
#. Send a pull request and bug the maintainer until it gets merged and published. :)
|
||||
Make sure to add yourself to `AUTHORS <https://github.com/requests/requests/blob/master/AUTHORS.rst>`_.
|
||||
|
||||
Feature Freeze
|
||||
--------------
|
||||
|
||||
As of v1.0.0, Requests has now entered a feature freeze. Requests for new
|
||||
features and Pull Requests implementing those features will not be accepted.
|
||||
|
||||
Development Dependencies
|
||||
------------------------
|
||||
|
||||
You'll need to install py.test in order to run the Requests' test suite::
|
||||
|
||||
$ venv .venv
|
||||
$ source .venv/bin/activate
|
||||
|
||||
$ make
|
||||
$ python setup.py test
|
||||
============================= test session starts ==============================
|
||||
platform darwin -- Python 3.4.4, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
|
||||
...
|
||||
collected 445 items
|
||||
|
||||
tests/test_hooks.py ...
|
||||
tests/test_lowlevel.py ............
|
||||
tests/test_requests.py ...........................................................
|
||||
tests/test_structures.py ....................
|
||||
tests/test_testserver.py ...........
|
||||
tests/test_utils.py ..s...........................................................
|
||||
|
||||
============== 442 passed, 1 skipped, 2 xpassed in 46.48 seconds ===============
|
||||
|
||||
You can also run ``$ make tests`` to run against all supported Python versions, using tox/detox.
|
||||
|
||||
Runtime Environments
|
||||
--------------------
|
||||
|
||||
Requests currently supports the following versions of Python:
|
||||
|
||||
- Python 2.6
|
||||
- Python 2.7
|
||||
- Python 3.4
|
||||
- Python 3.5
|
||||
- Python 3.6
|
||||
- PyPy
|
||||
|
||||
Google AppEngine is not officially supported although support is available
|
||||
with the `Requests-Toolbelt`_.
|
||||
|
||||
.. _Requests-Toolbelt: http://toolbelt.readthedocs.io/
|
||||
|
||||
168
docs/index.rst
168
docs/index.rst
@@ -3,18 +3,170 @@
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to Requests's documentation!
|
||||
====================================
|
||||
Requests: HTTP for Humans
|
||||
=========================
|
||||
|
||||
Contents:
|
||||
Release v\ |version|. (:ref:`Installation <install>`)
|
||||
|
||||
.. image:: https://img.shields.io/pypi/l/requests.svg
|
||||
:target: https://pypi.python.org/pypi/requests
|
||||
|
||||
.. image:: https://img.shields.io/pypi/wheel/requests.svg
|
||||
:target: https://pypi.python.org/pypi/requests
|
||||
|
||||
.. image:: https://img.shields.io/pypi/pyversions/requests.svg
|
||||
:target: https://pypi.python.org/pypi/requests
|
||||
|
||||
.. image:: https://codecov.io/github/requests/requests/coverage.svg?branch=master
|
||||
:target: https://codecov.io/github/requests/requests
|
||||
:alt: codecov.io
|
||||
|
||||
.. image:: https://img.shields.io/badge/Say%20Thanks!-🦉-1EAEDB.svg
|
||||
:target: https://saythanks.io/to/kennethreitz
|
||||
|
||||
|
||||
**Requests** is the only *Non-GMO* HTTP library for Python, safe for human
|
||||
consumption.
|
||||
|
||||
*Warning: Recreational use of the Python standard library for HTTP may result in dangerous side-effects,
|
||||
including: security vulnerabilities, verbose code, reinventing the wheel,
|
||||
constantly reading documentation, depression, headaches, or even death.*
|
||||
|
||||
-------------------
|
||||
|
||||
**Behold, the power of Requests**::
|
||||
|
||||
>>> import requests
|
||||
>>> r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
|
||||
>>> r.status_code
|
||||
200
|
||||
>>> r.headers['content-type']
|
||||
'application/json; charset=utf8'
|
||||
>>> r.encoding
|
||||
'utf-8'
|
||||
>>> r.text
|
||||
u'{"type":"User"...'
|
||||
>>> r.json()
|
||||
{u'private_gists': 419, u'total_private_repos': 77, ...}
|
||||
|
||||
See `similar code, sans Requests <https://gist.github.com/973705>`_.
|
||||
|
||||
|
||||
**Requests** allows you to send *organic, grass-fed* HTTP/1.1 requests, without the
|
||||
need for manual labor. There's no need to manually add query strings to your
|
||||
URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling
|
||||
are 100% automatic, thanks to `urllib3 <https://github.com/shazow/urllib3>`_.
|
||||
|
||||
User Testimonials
|
||||
-----------------
|
||||
|
||||
Twitter, Spotify, Microsoft, Amazon, Lyft, BuzzFeed, Reddit, The NSA, Her Majesty's Government, Google, Twilio, Runscope, Mozilla, Heroku,
|
||||
PayPal, NPR, Obama for America, Transifex, Native Instruments, The Washington
|
||||
Post, SoundCloud, Kippt, Sony, and Federal U.S.
|
||||
Institutions that prefer to be unnamed claim to use Requests internally.
|
||||
|
||||
**Armin Ronacher**—
|
||||
*Requests is the perfect example how beautiful an API can be with the
|
||||
right level of abstraction.*
|
||||
|
||||
**Matt DeBoard**—
|
||||
*I'm going to get Kenneth Reitz's Python requests module tattooed
|
||||
on my body, somehow. The whole thing.*
|
||||
|
||||
**Daniel Greenfeld**—
|
||||
*Nuked a 1200 LOC spaghetti code library with 10 lines of code thanks to
|
||||
Kenneth Reitz's request library. Today has been AWESOME.*
|
||||
|
||||
**Kenny Meyers**—
|
||||
*Python HTTP: When in doubt, or when not in doubt, use Requests. Beautiful,
|
||||
simple, Pythonic.*
|
||||
|
||||
Requests is one of the most downloaded Python packages of all time, pulling in
|
||||
over 11,000,000 downloads every month. All the cool kids are doing it!
|
||||
|
||||
Beloved Features
|
||||
----------------
|
||||
|
||||
Requests is ready for today's web.
|
||||
|
||||
- Keep-Alive & Connection Pooling
|
||||
- International Domains and URLs
|
||||
- Sessions with Cookie Persistence
|
||||
- Browser-style SSL Verification
|
||||
- Automatic Content Decoding
|
||||
- Basic/Digest Authentication
|
||||
- Elegant Key/Value Cookies
|
||||
- Automatic Decompression
|
||||
- Unicode Response Bodies
|
||||
- HTTP(S) Proxy Support
|
||||
- Multipart File Uploads
|
||||
- Streaming Downloads
|
||||
- Connection Timeouts
|
||||
- Chunked Requests
|
||||
- ``.netrc`` Support
|
||||
|
||||
Requests officially supports Python 2.6–2.7 & 3.4–3.7, and runs great on PyPy.
|
||||
|
||||
|
||||
The User Guide
|
||||
--------------
|
||||
|
||||
This part of the documentation, which is mostly prose, begins with some
|
||||
background information about Requests, then focuses on step-by-step
|
||||
instructions for getting the most out of Requests.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
user/intro
|
||||
user/install
|
||||
user/quickstart
|
||||
user/advanced
|
||||
user/authentication
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
||||
The Community Guide
|
||||
-------------------
|
||||
|
||||
This part of the documentation, which is mostly prose, details the
|
||||
Requests ecosystem and community.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
community/faq
|
||||
community/recommended
|
||||
community/out-there
|
||||
community/support
|
||||
community/vulnerabilities
|
||||
community/updates
|
||||
community/release-process
|
||||
|
||||
The API Documentation / Guide
|
||||
-----------------------------
|
||||
|
||||
If you are looking for information on a specific function, class, or method,
|
||||
this part of the documentation is for you.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
api
|
||||
|
||||
|
||||
The Contributor Guide
|
||||
---------------------
|
||||
|
||||
If you want to contribute to the project, this part of the documentation is for
|
||||
you.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
|
||||
dev/contributing
|
||||
dev/philosophy
|
||||
dev/todo
|
||||
dev/authors
|
||||
|
||||
There are no more guides. You are now guideless.
|
||||
Good luck.
|
||||
|
||||
453
docs/make.bat
453
docs/make.bat
@@ -1,190 +1,263 @@
|
||||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set BUILDDIR=_build
|
||||
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
||||
set I18NSPHINXOPTS=%SPHINXOPTS% .
|
||||
if NOT "%PAPER%" == "" (
|
||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
if "%1" == "help" (
|
||||
:help
|
||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||
echo. html to make standalone HTML files
|
||||
echo. dirhtml to make HTML files named index.html in directories
|
||||
echo. singlehtml to make a single large HTML file
|
||||
echo. pickle to make pickle files
|
||||
echo. json to make JSON files
|
||||
echo. htmlhelp to make HTML files and a HTML help project
|
||||
echo. qthelp to make HTML files and a qthelp project
|
||||
echo. devhelp to make HTML files and a Devhelp project
|
||||
echo. epub to make an epub
|
||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||
echo. text to make text files
|
||||
echo. man to make manual pages
|
||||
echo. texinfo to make Texinfo files
|
||||
echo. gettext to make PO message catalogs
|
||||
echo. changes to make an overview over all changed/added/deprecated items
|
||||
echo. linkcheck to check all external links for integrity
|
||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "clean" (
|
||||
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||
del /q /s %BUILDDIR%\*
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "html" (
|
||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dirhtml" (
|
||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "singlehtml" (
|
||||
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pickle" (
|
||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the pickle files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "json" (
|
||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the JSON files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "htmlhelp" (
|
||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "qthelp" (
|
||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Requests.qhcp
|
||||
echo.To view the help file:
|
||||
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Requests.ghc
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "devhelp" (
|
||||
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "epub" (
|
||||
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latex" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "text" (
|
||||
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "man" (
|
||||
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "texinfo" (
|
||||
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "gettext" (
|
||||
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "changes" (
|
||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.The overview file is in %BUILDDIR%/changes.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "linkcheck" (
|
||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Link check complete; look for any errors in the above output ^
|
||||
or in %BUILDDIR%/linkcheck/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "doctest" (
|
||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of doctests in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/doctest/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
:end
|
||||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set BUILDDIR=_build
|
||||
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
||||
set I18NSPHINXOPTS=%SPHINXOPTS% .
|
||||
if NOT "%PAPER%" == "" (
|
||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
if "%1" == "help" (
|
||||
:help
|
||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||
echo. html to make standalone HTML files
|
||||
echo. dirhtml to make HTML files named index.html in directories
|
||||
echo. singlehtml to make a single large HTML file
|
||||
echo. pickle to make pickle files
|
||||
echo. json to make JSON files
|
||||
echo. htmlhelp to make HTML files and a HTML help project
|
||||
echo. qthelp to make HTML files and a qthelp project
|
||||
echo. devhelp to make HTML files and a Devhelp project
|
||||
echo. epub to make an epub
|
||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||
echo. text to make text files
|
||||
echo. man to make manual pages
|
||||
echo. texinfo to make Texinfo files
|
||||
echo. gettext to make PO message catalogs
|
||||
echo. changes to make an overview over all changed/added/deprecated items
|
||||
echo. xml to make Docutils-native XML files
|
||||
echo. pseudoxml to make pseudoxml-XML files for display purposes
|
||||
echo. linkcheck to check all external links for integrity
|
||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||
echo. coverage to run coverage check of the documentation if enabled
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "clean" (
|
||||
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||
del /q /s %BUILDDIR%\*
|
||||
goto end
|
||||
)
|
||||
|
||||
|
||||
REM Check if sphinx-build is available and fallback to Python version if any
|
||||
%SPHINXBUILD% 1>NUL 2>NUL
|
||||
if errorlevel 9009 goto sphinx_python
|
||||
goto sphinx_ok
|
||||
|
||||
:sphinx_python
|
||||
|
||||
set SPHINXBUILD=python -m sphinx.__init__
|
||||
%SPHINXBUILD% 2> nul
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:sphinx_ok
|
||||
|
||||
|
||||
if "%1" == "html" (
|
||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dirhtml" (
|
||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "singlehtml" (
|
||||
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pickle" (
|
||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the pickle files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "json" (
|
||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the JSON files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "htmlhelp" (
|
||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "qthelp" (
|
||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Requests.qhcp
|
||||
echo.To view the help file:
|
||||
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Requests.ghc
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "devhelp" (
|
||||
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "epub" (
|
||||
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latex" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latexpdf" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
cd %BUILDDIR%/latex
|
||||
make all-pdf
|
||||
cd %~dp0
|
||||
echo.
|
||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latexpdfja" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
cd %BUILDDIR%/latex
|
||||
make all-pdf-ja
|
||||
cd %~dp0
|
||||
echo.
|
||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "text" (
|
||||
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "man" (
|
||||
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "texinfo" (
|
||||
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "gettext" (
|
||||
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "changes" (
|
||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.The overview file is in %BUILDDIR%/changes.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "linkcheck" (
|
||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Link check complete; look for any errors in the above output ^
|
||||
or in %BUILDDIR%/linkcheck/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "doctest" (
|
||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of doctests in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/doctest/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "coverage" (
|
||||
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of coverage in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/coverage/python.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "xml" (
|
||||
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The XML files are in %BUILDDIR%/xml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pseudoxml" (
|
||||
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
|
||||
goto end
|
||||
)
|
||||
|
||||
:end
|
||||
|
||||
990
docs/user/advanced.rst
Normal file
990
docs/user/advanced.rst
Normal file
@@ -0,0 +1,990 @@
|
||||
.. _advanced:
|
||||
|
||||
Advanced Usage
|
||||
==============
|
||||
|
||||
This document covers some of Requests more advanced features.
|
||||
|
||||
.. _session-objects:
|
||||
|
||||
Session Objects
|
||||
---------------
|
||||
|
||||
The Session object allows you to persist certain parameters across
|
||||
requests. It also persists cookies across all requests made from the
|
||||
Session instance, and will use ``urllib3``'s `connection pooling`_. So if
|
||||
you're making several requests to the same host, the underlying TCP
|
||||
connection will be reused, which can result in a significant performance
|
||||
increase (see `HTTP persistent connection`_).
|
||||
|
||||
A Session object has all the methods of the main Requests API.
|
||||
|
||||
Let's persist some cookies across requests::
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')
|
||||
r = s.get('http://httpbin.org/cookies')
|
||||
|
||||
print(r.text)
|
||||
# '{"cookies": {"sessioncookie": "123456789"}}'
|
||||
|
||||
|
||||
Sessions can also be used to provide default data to the request methods. This
|
||||
is done by providing data to the properties on a Session object::
|
||||
|
||||
s = requests.Session()
|
||||
s.auth = ('user', 'pass')
|
||||
s.headers.update({'x-test': 'true'})
|
||||
|
||||
# both 'x-test' and 'x-test2' are sent
|
||||
s.get('http://httpbin.org/headers', headers={'x-test2': 'true'})
|
||||
|
||||
|
||||
Any dictionaries that you pass to a request method will be merged with the
|
||||
session-level values that are set. The method-level parameters override session
|
||||
parameters.
|
||||
|
||||
Note, however, that method-level parameters will *not* be persisted across
|
||||
requests, even if using a session. This example will only send the cookies
|
||||
with the first request, but not the second::
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
r = s.get('http://httpbin.org/cookies', cookies={'from-my': 'browser'})
|
||||
print(r.text)
|
||||
# '{"cookies": {"from-my": "browser"}}'
|
||||
|
||||
r = s.get('http://httpbin.org/cookies')
|
||||
print(r.text)
|
||||
# '{"cookies": {}}'
|
||||
|
||||
|
||||
If you want to manually add cookies to your session, use the
|
||||
:ref:`Cookie utility functions <api-cookies>` to manipulate
|
||||
:attr:`Session.cookies <requests.Session.cookies>`.
|
||||
|
||||
Sessions can also be used as context managers::
|
||||
|
||||
with requests.Session() as s:
|
||||
s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')
|
||||
|
||||
This will make sure the session is closed as soon as the ``with`` block is
|
||||
exited, even if unhandled exceptions occurred.
|
||||
|
||||
|
||||
.. admonition:: Remove a Value From a Dict Parameter
|
||||
|
||||
Sometimes you'll want to omit session-level keys from a dict parameter. To
|
||||
do this, you simply set that key's value to ``None`` in the method-level
|
||||
parameter. It will automatically be omitted.
|
||||
|
||||
All values that are contained within a session are directly available to you.
|
||||
See the :ref:`Session API Docs <sessionapi>` to learn more.
|
||||
|
||||
.. _request-and-response-objects:
|
||||
|
||||
Request and Response Objects
|
||||
----------------------------
|
||||
|
||||
Whenever a call is made to ``requests.get()`` and friends, you are doing two
|
||||
major things. First, you are constructing a ``Request`` object which will be
|
||||
sent off to a server to request or query some resource. Second, a ``Response``
|
||||
object is generated once Requests gets a response back from the server.
|
||||
The ``Response`` object contains all of the information returned by the server and
|
||||
also contains the ``Request`` object you created originally. Here is a simple
|
||||
request to get some very important information from Wikipedia's servers::
|
||||
|
||||
>>> r = requests.get('http://en.wikipedia.org/wiki/Monty_Python')
|
||||
|
||||
If we want to access the headers the server sent back to us, we do this::
|
||||
|
||||
>>> r.headers
|
||||
{'content-length': '56170', 'x-content-type-options': 'nosniff', 'x-cache':
|
||||
'HIT from cp1006.eqiad.wmnet, MISS from cp1010.eqiad.wmnet', 'content-encoding':
|
||||
'gzip', 'age': '3080', 'content-language': 'en', 'vary': 'Accept-Encoding,Cookie',
|
||||
'server': 'Apache', 'last-modified': 'Wed, 13 Jun 2012 01:33:50 GMT',
|
||||
'connection': 'close', 'cache-control': 'private, s-maxage=0, max-age=0,
|
||||
must-revalidate', 'date': 'Thu, 14 Jun 2012 12:59:39 GMT', 'content-type':
|
||||
'text/html; charset=UTF-8', 'x-cache-lookup': 'HIT from cp1006.eqiad.wmnet:3128,
|
||||
MISS from cp1010.eqiad.wmnet:80'}
|
||||
|
||||
However, if we want to get the headers we sent the server, we simply access the
|
||||
request, and then the request's headers::
|
||||
|
||||
>>> r.request.headers
|
||||
{'Accept-Encoding': 'identity, deflate, compress, gzip',
|
||||
'Accept': '*/*', 'User-Agent': 'python-requests/1.2.0'}
|
||||
|
||||
.. _prepared-requests:
|
||||
|
||||
Prepared Requests
|
||||
-----------------
|
||||
|
||||
Whenever you receive a :class:`Response <requests.Response>` object
|
||||
from an API call or a Session call, the ``request`` attribute is actually the
|
||||
``PreparedRequest`` that was used. In some cases you may wish to do some extra
|
||||
work to the body or headers (or anything else really) before sending a
|
||||
request. The simple recipe for this is the following::
|
||||
|
||||
from requests import Request, Session
|
||||
|
||||
s = Session()
|
||||
|
||||
req = Request('POST', url, data=data, headers=headers)
|
||||
prepped = req.prepare()
|
||||
|
||||
# do something with prepped.body
|
||||
prepped.body = 'No, I want exactly this as the body.'
|
||||
|
||||
# do something with prepped.headers
|
||||
del prepped.headers['Content-Type']
|
||||
|
||||
resp = s.send(prepped,
|
||||
stream=stream,
|
||||
verify=verify,
|
||||
proxies=proxies,
|
||||
cert=cert,
|
||||
timeout=timeout
|
||||
)
|
||||
|
||||
print(resp.status_code)
|
||||
|
||||
Since you are not doing anything special with the ``Request`` object, you
|
||||
prepare it immediately and modify the ``PreparedRequest`` object. You then
|
||||
send that with the other parameters you would have sent to ``requests.*`` or
|
||||
``Session.*``.
|
||||
|
||||
However, the above code will lose some of the advantages of having a Requests
|
||||
:class:`Session <requests.Session>` object. In particular,
|
||||
:class:`Session <requests.Session>`-level state such as cookies will
|
||||
not get applied to your request. To get a
|
||||
:class:`PreparedRequest <requests.PreparedRequest>` with that state
|
||||
applied, replace the call to :meth:`Request.prepare()
|
||||
<requests.Request.prepare>` with a call to
|
||||
:meth:`Session.prepare_request() <requests.Session.prepare_request>`, like this::
|
||||
|
||||
from requests import Request, Session
|
||||
|
||||
s = Session()
|
||||
req = Request('GET', url, data=data, headers=headers)
|
||||
|
||||
prepped = s.prepare_request(req)
|
||||
|
||||
# do something with prepped.body
|
||||
prepped.body = 'Seriously, send exactly these bytes.'
|
||||
|
||||
# do something with prepped.headers
|
||||
prepped.headers['Keep-Dead'] = 'parrot'
|
||||
|
||||
resp = s.send(prepped,
|
||||
stream=stream,
|
||||
verify=verify,
|
||||
proxies=proxies,
|
||||
cert=cert,
|
||||
timeout=timeout
|
||||
)
|
||||
|
||||
print(resp.status_code)
|
||||
|
||||
.. _verification:
|
||||
|
||||
SSL Cert Verification
|
||||
---------------------
|
||||
|
||||
Requests verifies SSL certificates for HTTPS requests, just like a web browser.
|
||||
By default, SSL verification is enabled, and Requests will throw a SSLError if
|
||||
it's unable to verify the certificate::
|
||||
|
||||
>>> requests.get('https://requestb.in')
|
||||
requests.exceptions.SSLError: hostname 'requestb.in' doesn't match either of '*.herokuapp.com', 'herokuapp.com'
|
||||
|
||||
I don't have SSL setup on this domain, so it throws an exception. Excellent. GitHub does though::
|
||||
|
||||
>>> requests.get('https://github.com')
|
||||
<Response [200]>
|
||||
|
||||
You can pass ``verify`` the path to a CA_BUNDLE file or directory with certificates of trusted CAs::
|
||||
|
||||
>>> requests.get('https://github.com', verify='/path/to/certfile')
|
||||
|
||||
or persistent::
|
||||
|
||||
s = requests.Session()
|
||||
s.verify = '/path/to/certfile'
|
||||
|
||||
.. note:: If ``verify`` is set to a path to a directory, the directory must have been processed using
|
||||
the c_rehash utility supplied with OpenSSL.
|
||||
|
||||
This list of trusted CAs can also be specified through the ``REQUESTS_CA_BUNDLE`` environment variable.
|
||||
|
||||
Requests can also ignore verifying the SSL certificate if you set ``verify`` to False::
|
||||
|
||||
>>> requests.get('https://kennethreitz.org', verify=False)
|
||||
<Response [200]>
|
||||
|
||||
By default, ``verify`` is set to True. Option ``verify`` only applies to host certs.
|
||||
|
||||
Client Side Certificates
|
||||
------------------------
|
||||
|
||||
You can also specify a local cert to use as client side certificate, as a single
|
||||
file (containing the private key and the certificate) or as a tuple of both
|
||||
files' paths::
|
||||
|
||||
>>> requests.get('https://kennethreitz.org', cert=('/path/client.cert', '/path/client.key'))
|
||||
<Response [200]>
|
||||
|
||||
or persistent::
|
||||
|
||||
s = requests.Session()
|
||||
s.cert = '/path/client.cert'
|
||||
|
||||
If you specify a wrong path or an invalid cert, you'll get a SSLError::
|
||||
|
||||
>>> requests.get('https://kennethreitz.org', cert='/wrong_path/client.pem')
|
||||
SSLError: [Errno 336265225] _ssl.c:347: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib
|
||||
|
||||
.. warning:: The private key to your local certificate *must* be unencrypted.
|
||||
Currently, Requests does not support using encrypted keys.
|
||||
|
||||
.. _ca-certificates:
|
||||
|
||||
CA Certificates
|
||||
---------------
|
||||
|
||||
By default, Requests bundles a set of root CAs that it trusts, sourced from the
|
||||
`Mozilla trust store`_. However, these are only updated once for each Requests
|
||||
version. This means that if you pin a Requests version your certificates can
|
||||
become extremely out of date.
|
||||
|
||||
From Requests version 2.4.0 onwards, Requests will attempt to use certificates
|
||||
from `certifi`_ if it is present on the system. This allows for users to update
|
||||
their trusted certificates without having to change the code that runs on their
|
||||
system.
|
||||
|
||||
For the sake of security we recommend upgrading certifi frequently!
|
||||
|
||||
.. _HTTP persistent connection: https://en.wikipedia.org/wiki/HTTP_persistent_connection
|
||||
.. _connection pooling: http://urllib3.readthedocs.io/en/latest/reference/index.html#module-urllib3.connectionpool
|
||||
.. _certifi: http://certifi.io/
|
||||
.. _Mozilla trust store: https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt
|
||||
|
||||
.. _body-content-workflow:
|
||||
|
||||
Body Content Workflow
|
||||
---------------------
|
||||
|
||||
By default, when you make a request, the body of the response is downloaded
|
||||
immediately. You can override this behaviour and defer downloading the response
|
||||
body until you access the :attr:`Response.content <requests.Response.content>`
|
||||
attribute with the ``stream`` parameter::
|
||||
|
||||
tarball_url = 'https://github.com/requests/requests/tarball/master'
|
||||
r = requests.get(tarball_url, stream=True)
|
||||
|
||||
At this point only the response headers have been downloaded and the connection
|
||||
remains open, hence allowing us to make content retrieval conditional::
|
||||
|
||||
if int(r.headers['content-length']) < TOO_LONG:
|
||||
content = r.content
|
||||
...
|
||||
|
||||
You can further control the workflow by use of the :meth:`Response.iter_content() <requests.Response.iter_content>`
|
||||
and :meth:`Response.iter_lines() <requests.Response.iter_lines>` methods.
|
||||
Alternatively, you can read the undecoded body from the underlying
|
||||
urllib3 :class:`urllib3.HTTPResponse <urllib3.response.HTTPResponse>` at
|
||||
:attr:`Response.raw <requests.Response.raw>`.
|
||||
|
||||
If you set ``stream`` to ``True`` when making a request, Requests cannot
|
||||
release the connection back to the pool unless you consume all the data or call
|
||||
:meth:`Response.close <requests.Response.close>`. This can lead to
|
||||
inefficiency with connections. If you find yourself partially reading request
|
||||
bodies (or not reading them at all) while using ``stream=True``, you should
|
||||
make the request within a ``with`` statement to ensure it's always closed::
|
||||
|
||||
with requests.get('http://httpbin.org/get', stream=True) as r:
|
||||
# Do things with the response here.
|
||||
|
||||
.. _keep-alive:
|
||||
|
||||
Keep-Alive
|
||||
----------
|
||||
|
||||
Excellent news — thanks to urllib3, keep-alive is 100% automatic within a session!
|
||||
Any requests that you make within a session will automatically reuse the appropriate
|
||||
connection!
|
||||
|
||||
Note that connections are only released back to the pool for reuse once all body
|
||||
data has been read; be sure to either set ``stream`` to ``False`` or read the
|
||||
``content`` property of the ``Response`` object.
|
||||
|
||||
.. _streaming-uploads:
|
||||
|
||||
Streaming Uploads
|
||||
-----------------
|
||||
|
||||
Requests supports streaming uploads, which allow you to send large streams or
|
||||
files without reading them into memory. To stream and upload, simply provide a
|
||||
file-like object for your body::
|
||||
|
||||
with open('massive-body', 'rb') as f:
|
||||
requests.post('http://some.url/streamed', data=f)
|
||||
|
||||
.. warning:: It is strongly recommended that you open files in `binary mode`_.
|
||||
This is because Requests may attempt to provide the
|
||||
``Content-Length`` header for you, and if it does this value will
|
||||
be set to the number of *bytes* in the file. Errors may occur if
|
||||
you open the file in *text mode*.
|
||||
|
||||
.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files
|
||||
|
||||
|
||||
.. _chunk-encoding:
|
||||
|
||||
Chunk-Encoded Requests
|
||||
----------------------
|
||||
|
||||
Requests also supports Chunked transfer encoding for outgoing and incoming requests.
|
||||
To send a chunk-encoded request, simply provide a generator (or any iterator without
|
||||
a length) for your body::
|
||||
|
||||
def gen():
|
||||
yield 'hi'
|
||||
yield 'there'
|
||||
|
||||
requests.post('http://some.url/chunked', data=gen())
|
||||
|
||||
For chunked encoded responses, it's best to iterate over the data using
|
||||
:meth:`Response.iter_content() <requests.Response.iter_content>`. In
|
||||
an ideal situation you'll have set ``stream=True`` on the request, in which
|
||||
case you can iterate chunk-by-chunk by calling ``iter_content`` with a ``chunk_size``
|
||||
parameter of ``None``. If you want to set a maximum size of the chunk,
|
||||
you can set a ``chunk_size`` parameter to any integer.
|
||||
|
||||
|
||||
.. _multipart:
|
||||
|
||||
POST Multiple Multipart-Encoded Files
|
||||
-------------------------------------
|
||||
|
||||
You can send multiple files in one request. For example, suppose you want to
|
||||
upload image files to an HTML form with a multiple file field 'images'::
|
||||
|
||||
<input type="file" name="images" multiple="true" required="true"/>
|
||||
|
||||
To do that, just set files to a list of tuples of ``(form_field_name, file_info)``::
|
||||
|
||||
>>> url = 'http://httpbin.org/post'
|
||||
>>> multiple_files = [
|
||||
('images', ('foo.png', open('foo.png', 'rb'), 'image/png')),
|
||||
('images', ('bar.png', open('bar.png', 'rb'), 'image/png'))]
|
||||
>>> r = requests.post(url, files=multiple_files)
|
||||
>>> r.text
|
||||
{
|
||||
...
|
||||
'files': {'images': 'data:image/png;base64,iVBORw ....'}
|
||||
'Content-Type': 'multipart/form-data; boundary=3131623adb2043caaeb5538cc7aa0b3a',
|
||||
...
|
||||
}
|
||||
|
||||
.. warning:: It is strongly recommended that you open files in `binary mode`_.
|
||||
This is because Requests may attempt to provide the
|
||||
``Content-Length`` header for you, and if it does this value will
|
||||
be set to the number of *bytes* in the file. Errors may occur if
|
||||
you open the file in *text mode*.
|
||||
|
||||
.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files
|
||||
|
||||
|
||||
.. _event-hooks:
|
||||
|
||||
Event Hooks
|
||||
-----------
|
||||
|
||||
Requests has a hook system that you can use to manipulate portions of
|
||||
the request process, or signal event handling.
|
||||
|
||||
Available hooks:
|
||||
|
||||
``response``:
|
||||
The response generated from a Request.
|
||||
|
||||
|
||||
You can assign a hook function on a per-request basis by passing a
|
||||
``{hook_name: callback_function}`` dictionary to the ``hooks`` request
|
||||
parameter::
|
||||
|
||||
hooks=dict(response=print_url)
|
||||
|
||||
That ``callback_function`` will receive a chunk of data as its first
|
||||
argument.
|
||||
|
||||
::
|
||||
|
||||
def print_url(r, *args, **kwargs):
|
||||
print(r.url)
|
||||
|
||||
If an error occurs while executing your callback, a warning is given.
|
||||
|
||||
If the callback function returns a value, it is assumed that it is to
|
||||
replace the data that was passed in. If the function doesn't return
|
||||
anything, nothing else is effected.
|
||||
|
||||
Let's print some request method arguments at runtime::
|
||||
|
||||
>>> requests.get('http://httpbin.org', hooks=dict(response=print_url))
|
||||
http://httpbin.org
|
||||
<Response [200]>
|
||||
|
||||
.. _custom-auth:
|
||||
|
||||
Custom Authentication
|
||||
---------------------
|
||||
|
||||
Requests allows you to use specify your own authentication mechanism.
|
||||
|
||||
Any callable which is passed as the ``auth`` argument to a request method will
|
||||
have the opportunity to modify the request before it is dispatched.
|
||||
|
||||
Authentication implementations are subclasses of :class:`AuthBase <requests.auth.AuthBase>`,
|
||||
and are easy to define. Requests provides two common authentication scheme
|
||||
implementations in ``requests.auth``: :class:`HTTPBasicAuth <requests.auth.HTTPBasicAuth>` and
|
||||
:class:`HTTPDigestAuth <requests.auth.HTTPDigestAuth>`.
|
||||
|
||||
Let's pretend that we have a web service that will only respond if the
|
||||
``X-Pizza`` header is set to a password value. Unlikely, but just go with it.
|
||||
|
||||
::
|
||||
|
||||
from requests.auth import AuthBase
|
||||
|
||||
class PizzaAuth(AuthBase):
|
||||
"""Attaches HTTP Pizza Authentication to the given Request object."""
|
||||
def __init__(self, username):
|
||||
# setup any auth-related data here
|
||||
self.username = username
|
||||
|
||||
def __call__(self, r):
|
||||
# modify and return the request
|
||||
r.headers['X-Pizza'] = self.username
|
||||
return r
|
||||
|
||||
Then, we can make a request using our Pizza Auth::
|
||||
|
||||
>>> requests.get('http://pizzabin.org/admin', auth=PizzaAuth('kenneth'))
|
||||
<Response [200]>
|
||||
|
||||
.. _streaming-requests:
|
||||
|
||||
Streaming Requests
|
||||
------------------
|
||||
|
||||
With :meth:`Response.iter_lines() <requests.Response.iter_lines>` you can easily
|
||||
iterate over streaming APIs such as the `Twitter Streaming
|
||||
API <https://dev.twitter.com/streaming/overview>`_. Simply
|
||||
set ``stream`` to ``True`` and iterate over the response with
|
||||
:meth:`~requests.Response.iter_lines()`::
|
||||
|
||||
import json
|
||||
import requests
|
||||
|
||||
r = requests.get('http://httpbin.org/stream/20', stream=True)
|
||||
|
||||
for line in r.iter_lines():
|
||||
|
||||
# filter out keep-alive new lines
|
||||
if line:
|
||||
decoded_line = line.decode('utf-8')
|
||||
print(json.loads(decoded_line))
|
||||
|
||||
When using `decode_unicode=True` with
|
||||
:meth:`Response.iter_lines() <requests.Response.iter_lines>` or
|
||||
:meth:`Response.iter_content() <requests.Response.iter_content>`, you'll want
|
||||
to provide a fallback encoding in the event the server doesn't provide one::
|
||||
|
||||
r = requests.get('http://httpbin.org/stream/20', stream=True)
|
||||
|
||||
if r.encoding is None:
|
||||
r.encoding = 'utf-8'
|
||||
|
||||
for line in r.iter_lines(decode_unicode=True):
|
||||
if line:
|
||||
print(json.loads(line))
|
||||
|
||||
.. warning::
|
||||
|
||||
:meth:`~requests.Response.iter_lines()` is not reentrant safe.
|
||||
Calling this method multiple times causes some of the received data
|
||||
being lost. In case you need to call it from multiple places, use
|
||||
the resulting iterator object instead::
|
||||
|
||||
lines = r.iter_lines()
|
||||
# Save the first line for later or just skip it
|
||||
|
||||
first_line = next(lines)
|
||||
|
||||
for line in lines:
|
||||
print(line)
|
||||
|
||||
.. _proxies:
|
||||
|
||||
Proxies
|
||||
-------
|
||||
|
||||
If you need to use a proxy, you can configure individual requests with the
|
||||
``proxies`` argument to any request method::
|
||||
|
||||
import requests
|
||||
|
||||
proxies = {
|
||||
'http': 'http://10.10.1.10:3128',
|
||||
'https': 'http://10.10.1.10:1080',
|
||||
}
|
||||
|
||||
requests.get('http://example.org', proxies=proxies)
|
||||
|
||||
You can also configure proxies by setting the environment variables
|
||||
``HTTP_PROXY`` and ``HTTPS_PROXY``.
|
||||
|
||||
::
|
||||
|
||||
$ export HTTP_PROXY="http://10.10.1.10:3128"
|
||||
$ export HTTPS_PROXY="http://10.10.1.10:1080"
|
||||
|
||||
$ python
|
||||
>>> import requests
|
||||
>>> requests.get('http://example.org')
|
||||
|
||||
To use HTTP Basic Auth with your proxy, use the `http://user:password@host/` syntax::
|
||||
|
||||
proxies = {'http': 'http://user:pass@10.10.1.10:3128/'}
|
||||
|
||||
To give a proxy for a specific scheme and host, use the
|
||||
`scheme://hostname` form for the key. This will match for
|
||||
any request to the given scheme and exact hostname.
|
||||
|
||||
::
|
||||
|
||||
proxies = {'http://10.20.1.128': 'http://10.10.1.10:5323'}
|
||||
|
||||
Note that proxy URLs must include the scheme.
|
||||
|
||||
SOCKS
|
||||
^^^^^
|
||||
|
||||
.. versionadded:: 2.10.0
|
||||
|
||||
In addition to basic HTTP proxies, Requests also supports proxies using the
|
||||
SOCKS protocol. This is an optional feature that requires that additional
|
||||
third-party libraries be installed before use.
|
||||
|
||||
You can get the dependencies for this feature from ``pip``:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pip install requests[socks]
|
||||
|
||||
Once you've installed those dependencies, using a SOCKS proxy is just as easy
|
||||
as using a HTTP one::
|
||||
|
||||
proxies = {
|
||||
'http': 'socks5://user:pass@host:port',
|
||||
'https': 'socks5://user:pass@host:port'
|
||||
}
|
||||
|
||||
Using the scheme ``socks5`` causes the DNS resolution to happen on the client, rather than on the proxy server. This is in line with curl, which uses the scheme to decide whether to do the DNS resolution on the client or proxy. If you want to resolve the domains on the proxy server, use ``socks5h`` as the scheme.
|
||||
|
||||
.. _compliance:
|
||||
|
||||
Compliance
|
||||
----------
|
||||
|
||||
Requests is intended to be compliant with all relevant specifications and
|
||||
RFCs where that compliance will not cause difficulties for users. This
|
||||
attention to the specification can lead to some behaviour that may seem
|
||||
unusual to those not familiar with the relevant specification.
|
||||
|
||||
Encodings
|
||||
^^^^^^^^^
|
||||
|
||||
When you receive a response, Requests makes a guess at the encoding to
|
||||
use for decoding the response when you access the :attr:`Response.text
|
||||
<requests.Response.text>` attribute. Requests will first check for an
|
||||
encoding in the HTTP header, and if none is present, will use `chardet
|
||||
<http://pypi.python.org/pypi/chardet>`_ to attempt to guess the encoding.
|
||||
|
||||
The only time Requests will not do this is if no explicit charset
|
||||
is present in the HTTP headers **and** the ``Content-Type``
|
||||
header contains ``text``. In this situation, `RFC 2616
|
||||
<http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1>`_ specifies
|
||||
that the default charset must be ``ISO-8859-1``. Requests follows the
|
||||
specification in this case. If you require a different encoding, you can
|
||||
manually set the :attr:`Response.encoding <requests.Response.encoding>`
|
||||
property, or use the raw :attr:`Response.content <requests.Response.content>`.
|
||||
|
||||
.. _http-verbs:
|
||||
|
||||
HTTP Verbs
|
||||
----------
|
||||
|
||||
Requests provides access to almost the full range of HTTP verbs: GET, OPTIONS,
|
||||
HEAD, POST, PUT, PATCH and DELETE. The following provides detailed examples of
|
||||
using these various verbs in Requests, using the GitHub API.
|
||||
|
||||
We will begin with the verb most commonly used: GET. HTTP GET is an idempotent
|
||||
method that returns a resource from a given URL. As a result, it is the verb
|
||||
you ought to use when attempting to retrieve data from a web location. An
|
||||
example usage would be attempting to get information about a specific commit
|
||||
from GitHub. Suppose we wanted commit ``a050faf`` on Requests. We would get it
|
||||
like so::
|
||||
|
||||
>>> import requests
|
||||
>>> r = requests.get('https://api.github.com/repos/requests/requests/git/commits/a050faf084662f3a352dd1a941f2c7c9f886d4ad')
|
||||
|
||||
We should confirm that GitHub responded correctly. If it has, we want to work
|
||||
out what type of content it is. Do this like so::
|
||||
|
||||
>>> if r.status_code == requests.codes.ok:
|
||||
... print(r.headers['content-type'])
|
||||
...
|
||||
application/json; charset=utf-8
|
||||
|
||||
So, GitHub returns JSON. That's great, we can use the :meth:`r.json
|
||||
<requests.Response.json>` method to parse it into Python objects.
|
||||
|
||||
::
|
||||
|
||||
>>> commit_data = r.json()
|
||||
|
||||
>>> print(commit_data.keys())
|
||||
[u'committer', u'author', u'url', u'tree', u'sha', u'parents', u'message']
|
||||
|
||||
>>> print(commit_data[u'committer'])
|
||||
{u'date': u'2012-05-10T11:10:50-07:00', u'email': u'me@kennethreitz.com', u'name': u'Kenneth Reitz'}
|
||||
|
||||
>>> print(commit_data[u'message'])
|
||||
makin' history
|
||||
|
||||
So far, so simple. Well, let's investigate the GitHub API a little bit. Now,
|
||||
we could look at the documentation, but we might have a little more fun if we
|
||||
use Requests instead. We can take advantage of the Requests OPTIONS verb to
|
||||
see what kinds of HTTP methods are supported on the url we just used.
|
||||
|
||||
::
|
||||
|
||||
>>> verbs = requests.options(r.url)
|
||||
>>> verbs.status_code
|
||||
500
|
||||
|
||||
Uh, what? That's unhelpful! Turns out GitHub, like many API providers, don't
|
||||
actually implement the OPTIONS method. This is an annoying oversight, but it's
|
||||
OK, we can just use the boring documentation. If GitHub had correctly
|
||||
implemented OPTIONS, however, they should return the allowed methods in the
|
||||
headers, e.g.
|
||||
|
||||
::
|
||||
|
||||
>>> verbs = requests.options('http://a-good-website.com/api/cats')
|
||||
>>> print(verbs.headers['allow'])
|
||||
GET,HEAD,POST,OPTIONS
|
||||
|
||||
Turning to the documentation, we see that the only other method allowed for
|
||||
commits is POST, which creates a new commit. As we're using the Requests repo,
|
||||
we should probably avoid making ham-handed POSTS to it. Instead, let's play
|
||||
with the Issues feature of GitHub.
|
||||
|
||||
This documentation was added in response to
|
||||
`Issue #482 <https://github.com/requests/requests/issues/482>`_. Given that
|
||||
this issue already exists, we will use it as an example. Let's start by getting it.
|
||||
|
||||
::
|
||||
|
||||
>>> r = requests.get('https://api.github.com/repos/requests/requests/issues/482')
|
||||
>>> r.status_code
|
||||
200
|
||||
|
||||
>>> issue = json.loads(r.text)
|
||||
|
||||
>>> print(issue[u'title'])
|
||||
Feature any http verb in docs
|
||||
|
||||
>>> print(issue[u'comments'])
|
||||
3
|
||||
|
||||
Cool, we have three comments. Let's take a look at the last of them.
|
||||
|
||||
::
|
||||
|
||||
>>> r = requests.get(r.url + u'/comments')
|
||||
>>> r.status_code
|
||||
200
|
||||
|
||||
>>> comments = r.json()
|
||||
|
||||
>>> print(comments[0].keys())
|
||||
[u'body', u'url', u'created_at', u'updated_at', u'user', u'id']
|
||||
|
||||
>>> print(comments[2][u'body'])
|
||||
Probably in the "advanced" section
|
||||
|
||||
Well, that seems like a silly place. Let's post a comment telling the poster
|
||||
that he's silly. Who is the poster, anyway?
|
||||
|
||||
::
|
||||
|
||||
>>> print(comments[2][u'user'][u'login'])
|
||||
kennethreitz
|
||||
|
||||
OK, so let's tell this Kenneth guy that we think this example should go in the
|
||||
quickstart guide instead. According to the GitHub API doc, the way to do this
|
||||
is to POST to the thread. Let's do it.
|
||||
|
||||
::
|
||||
|
||||
>>> body = json.dumps({u"body": u"Sounds great! I'll get right on it!"})
|
||||
>>> url = u"https://api.github.com/repos/requests/requests/issues/482/comments"
|
||||
|
||||
>>> r = requests.post(url=url, data=body)
|
||||
>>> r.status_code
|
||||
404
|
||||
|
||||
Huh, that's weird. We probably need to authenticate. That'll be a pain, right?
|
||||
Wrong. Requests makes it easy to use many forms of authentication, including
|
||||
the very common Basic Auth.
|
||||
|
||||
::
|
||||
|
||||
>>> from requests.auth import HTTPBasicAuth
|
||||
>>> auth = HTTPBasicAuth('fake@example.com', 'not_a_real_password')
|
||||
|
||||
>>> r = requests.post(url=url, data=body, auth=auth)
|
||||
>>> r.status_code
|
||||
201
|
||||
|
||||
>>> content = r.json()
|
||||
>>> print(content[u'body'])
|
||||
Sounds great! I'll get right on it.
|
||||
|
||||
Brilliant. Oh, wait, no! I meant to add that it would take me a while, because
|
||||
I had to go feed my cat. If only I could edit this comment! Happily, GitHub
|
||||
allows us to use another HTTP verb, PATCH, to edit this comment. Let's do
|
||||
that.
|
||||
|
||||
::
|
||||
|
||||
>>> print(content[u"id"])
|
||||
5804413
|
||||
|
||||
>>> body = json.dumps({u"body": u"Sounds great! I'll get right on it once I feed my cat."})
|
||||
>>> url = u"https://api.github.com/repos/requests/requests/issues/comments/5804413"
|
||||
|
||||
>>> r = requests.patch(url=url, data=body, auth=auth)
|
||||
>>> r.status_code
|
||||
200
|
||||
|
||||
Excellent. Now, just to torture this Kenneth guy, I've decided to let him
|
||||
sweat and not tell him that I'm working on this. That means I want to delete
|
||||
this comment. GitHub lets us delete comments using the incredibly aptly named
|
||||
DELETE method. Let's get rid of it.
|
||||
|
||||
::
|
||||
|
||||
>>> r = requests.delete(url=url, auth=auth)
|
||||
>>> r.status_code
|
||||
204
|
||||
>>> r.headers['status']
|
||||
'204 No Content'
|
||||
|
||||
Excellent. All gone. The last thing I want to know is how much of my ratelimit
|
||||
I've used. Let's find out. GitHub sends that information in the headers, so
|
||||
rather than download the whole page I'll send a HEAD request to get the
|
||||
headers.
|
||||
|
||||
::
|
||||
|
||||
>>> r = requests.head(url=url, auth=auth)
|
||||
>>> print(r.headers)
|
||||
...
|
||||
'x-ratelimit-remaining': '4995'
|
||||
'x-ratelimit-limit': '5000'
|
||||
...
|
||||
|
||||
Excellent. Time to write a Python program that abuses the GitHub API in all
|
||||
kinds of exciting ways, 4995 more times.
|
||||
|
||||
.. _custom-verbs:
|
||||
|
||||
Custom Verbs
|
||||
------------
|
||||
|
||||
From time to time you may be working with a server that, for whatever reason,
|
||||
allows use or even requires use of HTTP verbs not covered above. One example of
|
||||
this would be the MKCOL method some WEBDAV servers use. Do not fret, these can
|
||||
still be used with Requests. These make use of the built-in ``.request``
|
||||
method. For example::
|
||||
|
||||
>>> r = requests.request('MKCOL', url, data=data)
|
||||
>>> r.status_code
|
||||
200 # Assuming your call was correct
|
||||
|
||||
Utilising this, you can make use of any method verb that your server allows.
|
||||
|
||||
|
||||
.. _link-headers:
|
||||
|
||||
Link Headers
|
||||
------------
|
||||
|
||||
Many HTTP APIs feature Link headers. They make APIs more self describing and
|
||||
discoverable.
|
||||
|
||||
GitHub uses these for `pagination <http://developer.github.com/v3/#pagination>`_
|
||||
in their API, for example::
|
||||
|
||||
>>> url = 'https://api.github.com/users/kennethreitz/repos?page=1&per_page=10'
|
||||
>>> r = requests.head(url=url)
|
||||
>>> r.headers['link']
|
||||
'<https://api.github.com/users/kennethreitz/repos?page=2&per_page=10>; rel="next", <https://api.github.com/users/kennethreitz/repos?page=6&per_page=10>; rel="last"'
|
||||
|
||||
Requests will automatically parse these link headers and make them easily consumable::
|
||||
|
||||
>>> r.links["next"]
|
||||
{'url': 'https://api.github.com/users/kennethreitz/repos?page=2&per_page=10', 'rel': 'next'}
|
||||
|
||||
>>> r.links["last"]
|
||||
{'url': 'https://api.github.com/users/kennethreitz/repos?page=7&per_page=10', 'rel': 'last'}
|
||||
|
||||
.. _transport-adapters:
|
||||
|
||||
Transport Adapters
|
||||
------------------
|
||||
|
||||
As of v1.0.0, Requests has moved to a modular internal design. Part of the
|
||||
reason this was done was to implement Transport Adapters, originally
|
||||
`described here`_. Transport Adapters provide a mechanism to define interaction
|
||||
methods for an HTTP service. In particular, they allow you to apply per-service
|
||||
configuration.
|
||||
|
||||
Requests ships with a single Transport Adapter, the :class:`HTTPAdapter
|
||||
<requests.adapters.HTTPAdapter>`. This adapter provides the default Requests
|
||||
interaction with HTTP and HTTPS using the powerful `urllib3`_ library. Whenever
|
||||
a Requests :class:`Session <requests.Session>` is initialized, one of these is
|
||||
attached to the :class:`Session <requests.Session>` object for HTTP, and one
|
||||
for HTTPS.
|
||||
|
||||
Requests enables users to create and use their own Transport Adapters that
|
||||
provide specific functionality. Once created, a Transport Adapter can be
|
||||
mounted to a Session object, along with an indication of which web services
|
||||
it should apply to.
|
||||
|
||||
::
|
||||
|
||||
>>> s = requests.Session()
|
||||
>>> s.mount('http://www.github.com', MyAdapter())
|
||||
|
||||
The mount call registers a specific instance of a Transport Adapter to a
|
||||
prefix. Once mounted, any HTTP request made using that session whose URL starts
|
||||
with the given prefix will use the given Transport Adapter.
|
||||
|
||||
Many of the details of implementing a Transport Adapter are beyond the scope of
|
||||
this documentation, but take a look at the next example for a simple SSL use-
|
||||
case. For more than that, you might look at subclassing the
|
||||
:class:`BaseAdapter <requests.adapters.BaseAdapter>`.
|
||||
|
||||
Example: Specific SSL Version
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The Requests team has made a specific choice to use whatever SSL version is
|
||||
default in the underlying library (`urllib3`_). Normally this is fine, but from
|
||||
time to time, you might find yourself needing to connect to a service-endpoint
|
||||
that uses a version that isn't compatible with the default.
|
||||
|
||||
You can use Transport Adapters for this by taking most of the existing
|
||||
implementation of HTTPAdapter, and adding a parameter *ssl_version* that gets
|
||||
passed-through to `urllib3`. We'll make a Transport Adapter that instructs the
|
||||
library to use SSLv3::
|
||||
|
||||
import ssl
|
||||
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.poolmanager import PoolManager
|
||||
|
||||
|
||||
class Ssl3HttpAdapter(HTTPAdapter):
|
||||
""""Transport adapter" that allows us to use SSLv3."""
|
||||
|
||||
def init_poolmanager(self, connections, maxsize, block=False):
|
||||
self.poolmanager = PoolManager(
|
||||
num_pools=connections, maxsize=maxsize,
|
||||
block=block, ssl_version=ssl.PROTOCOL_SSLv3)
|
||||
|
||||
.. _`described here`: http://www.kennethreitz.org/essays/the-future-of-python-http
|
||||
.. _`urllib3`: https://github.com/shazow/urllib3
|
||||
|
||||
.. _blocking-or-nonblocking:
|
||||
|
||||
Blocking Or Non-Blocking?
|
||||
-------------------------
|
||||
|
||||
With the default Transport Adapter in place, Requests does not provide any kind
|
||||
of non-blocking IO. The :attr:`Response.content <requests.Response.content>`
|
||||
property will block until the entire response has been downloaded. If
|
||||
you require more granularity, the streaming features of the library (see
|
||||
:ref:`streaming-requests`) allow you to retrieve smaller quantities of the
|
||||
response at a time. However, these calls will still block.
|
||||
|
||||
If you are concerned about the use of blocking IO, there are lots of projects
|
||||
out there that combine Requests with one of Python's asynchronicity frameworks.
|
||||
Two excellent examples are `grequests`_ and `requests-futures`_.
|
||||
|
||||
.. _`grequests`: https://github.com/kennethreitz/grequests
|
||||
.. _`requests-futures`: https://github.com/ross/requests-futures
|
||||
|
||||
Header Ordering
|
||||
---------------
|
||||
|
||||
In unusual circumstances you may want to provide headers in an ordered manner. If you pass an ``OrderedDict`` to the ``headers`` keyword argument, that will provide the headers with an ordering. *However*, the ordering of the default headers used by Requests will be preferred, which means that if you override default headers in the ``headers`` keyword argument, they may appear out of order compared to other headers in that keyword argument.
|
||||
|
||||
If this is problematic, users should consider setting the default headers on a :class:`Session <requests.Session>` object, by setting :attr:`Session <requests.Session.headers>` to a custom ``OrderedDict``. That ordering will always be preferred.
|
||||
|
||||
.. _timeouts:
|
||||
|
||||
Timeouts
|
||||
--------
|
||||
|
||||
Most requests to external servers should have a timeout attached, in case the
|
||||
server is not responding in a timely manner. By default, requests do not time
|
||||
out unless a timeout value is set explicitly. Without a timeout, your code may
|
||||
hang for minutes or more.
|
||||
|
||||
The **connect** timeout is the number of seconds Requests will wait for your
|
||||
client to establish a connection to a remote machine (corresponding to the
|
||||
`connect()`_) call on the socket. It's a good practice to set connect timeouts
|
||||
to slightly larger than a multiple of 3, which is the default `TCP packet
|
||||
retransmission window <http://www.hjp.at/doc/rfc/rfc2988.txt>`_.
|
||||
|
||||
Once your client has connected to the server and sent the HTTP request, the
|
||||
**read** timeout is the number of seconds the client will wait for the server
|
||||
to send a response. (Specifically, it's the number of seconds that the client
|
||||
will wait *between* bytes sent from the server. In 99.9% of cases, this is the
|
||||
time before the server sends the first byte).
|
||||
|
||||
If you specify a single value for the timeout, like this::
|
||||
|
||||
r = requests.get('https://github.com', timeout=5)
|
||||
|
||||
The timeout value will be applied to both the ``connect`` and the ``read``
|
||||
timeouts. Specify a tuple if you would like to set the values separately::
|
||||
|
||||
r = requests.get('https://github.com', timeout=(3.05, 27))
|
||||
|
||||
If the remote server is very slow, you can tell Requests to wait forever for
|
||||
a response, by passing None as a timeout value and then retrieving a cup of
|
||||
coffee.
|
||||
|
||||
::
|
||||
|
||||
r = requests.get('https://github.com', timeout=None)
|
||||
|
||||
.. _`connect()`: http://linux.die.net/man/2/connect
|
||||
144
docs/user/authentication.rst
Normal file
144
docs/user/authentication.rst
Normal file
@@ -0,0 +1,144 @@
|
||||
.. _authentication:
|
||||
|
||||
Authentication
|
||||
==============
|
||||
|
||||
This document discusses using various kinds of authentication with Requests.
|
||||
|
||||
Many web services require authentication, and there are many different types.
|
||||
Below, we outline various forms of authentication available in Requests, from
|
||||
the simple to the complex.
|
||||
|
||||
|
||||
Basic Authentication
|
||||
--------------------
|
||||
|
||||
Many web services that require authentication accept HTTP Basic Auth. This is
|
||||
the simplest kind, and Requests supports it straight out of the box.
|
||||
|
||||
Making requests with HTTP Basic Auth is very simple::
|
||||
|
||||
>>> from requests.auth import HTTPBasicAuth
|
||||
>>> requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', 'pass'))
|
||||
<Response [200]>
|
||||
|
||||
In fact, HTTP Basic Auth is so common that Requests provides a handy shorthand
|
||||
for using it::
|
||||
|
||||
>>> requests.get('https://api.github.com/user', auth=('user', 'pass'))
|
||||
<Response [200]>
|
||||
|
||||
Providing the credentials in a tuple like this is exactly the same as the
|
||||
``HTTPBasicAuth`` example above.
|
||||
|
||||
|
||||
netrc Authentication
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If no authentication method is given with the ``auth`` argument, Requests will
|
||||
attempt to get the authentication credentials for the URL's hostname from the
|
||||
user's netrc file. The netrc file overrides raw HTTP authentication headers
|
||||
set with `headers=`.
|
||||
|
||||
If credentials for the hostname are found, the request is sent with HTTP Basic
|
||||
Auth.
|
||||
|
||||
|
||||
Digest Authentication
|
||||
---------------------
|
||||
|
||||
Another very popular form of HTTP Authentication is Digest Authentication,
|
||||
and Requests supports this out of the box as well::
|
||||
|
||||
>>> from requests.auth import HTTPDigestAuth
|
||||
>>> url = 'http://httpbin.org/digest-auth/auth/user/pass'
|
||||
>>> requests.get(url, auth=HTTPDigestAuth('user', 'pass'))
|
||||
<Response [200]>
|
||||
|
||||
|
||||
OAuth 1 Authentication
|
||||
----------------------
|
||||
|
||||
A common form of authentication for several web APIs is OAuth. The ``requests-oauthlib``
|
||||
library allows Requests users to easily make OAuth 1 authenticated requests::
|
||||
|
||||
>>> import requests
|
||||
>>> from requests_oauthlib import OAuth1
|
||||
|
||||
>>> url = 'https://api.twitter.com/1.1/account/verify_credentials.json'
|
||||
>>> auth = OAuth1('YOUR_APP_KEY', 'YOUR_APP_SECRET',
|
||||
... 'USER_OAUTH_TOKEN', 'USER_OAUTH_TOKEN_SECRET')
|
||||
|
||||
>>> requests.get(url, auth=auth)
|
||||
<Response [200]>
|
||||
|
||||
For more information on how to OAuth flow works, please see the official `OAuth`_ website.
|
||||
For examples and documentation on requests-oauthlib, please see the `requests_oauthlib`_
|
||||
repository on GitHub
|
||||
|
||||
OAuth 2 and OpenID Connect Authentication
|
||||
-----------------------------------------
|
||||
|
||||
The ``requests-oauthlib`` library also handles OAuth 2, the authentication mechanism
|
||||
underpinning OpenID Connect. See the `requests-oauthlib OAuth2 documentation`_ for
|
||||
details of the various OAuth 2 credential management flows:
|
||||
|
||||
* `Web Application Flow`_
|
||||
* `Mobile Application Flow`_
|
||||
* `Legacy Application Flow`_
|
||||
* `Backend Application Flow`_
|
||||
|
||||
Other Authentication
|
||||
--------------------
|
||||
|
||||
Requests is designed to allow other forms of authentication to be easily and
|
||||
quickly plugged in. Members of the open-source community frequently write
|
||||
authentication handlers for more complicated or less commonly-used forms of
|
||||
authentication. Some of the best have been brought together under the
|
||||
`Requests organization`_, including:
|
||||
|
||||
- Kerberos_
|
||||
- NTLM_
|
||||
|
||||
If you want to use any of these forms of authentication, go straight to their
|
||||
GitHub page and follow the instructions.
|
||||
|
||||
|
||||
New Forms of Authentication
|
||||
---------------------------
|
||||
|
||||
If you can't find a good implementation of the form of authentication you
|
||||
want, you can implement it yourself. Requests makes it easy to add your own
|
||||
forms of authentication.
|
||||
|
||||
To do so, subclass :class:`AuthBase <requests.auth.AuthBase>` and implement the
|
||||
``__call__()`` method::
|
||||
|
||||
>>> import requests
|
||||
>>> class MyAuth(requests.auth.AuthBase):
|
||||
... def __call__(self, r):
|
||||
... # Implement my authentication
|
||||
... return r
|
||||
...
|
||||
>>> url = 'http://httpbin.org/get'
|
||||
>>> requests.get(url, auth=MyAuth())
|
||||
<Response [200]>
|
||||
|
||||
When an authentication handler is attached to a request,
|
||||
it is called during request setup. The ``__call__`` method must therefore do
|
||||
whatever is required to make the authentication work. Some forms of
|
||||
authentication will additionally add hooks to provide further functionality.
|
||||
|
||||
Further examples can be found under the `Requests organization`_ and in the
|
||||
``auth.py`` file.
|
||||
|
||||
.. _OAuth: http://oauth.net/
|
||||
.. _requests_oauthlib: https://github.com/requests/requests-oauthlib
|
||||
.. _requests-oauthlib OAuth2 documentation: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html
|
||||
.. _Web Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#web-application-flow
|
||||
.. _Mobile Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#mobile-application-flow
|
||||
.. _Legacy Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#legacy-application-flow
|
||||
.. _Backend Application Flow: http://requests-oauthlib.readthedocs.io/en/latest/oauth2_workflow.html#backend-application-flow
|
||||
.. _Kerberos: https://github.com/requests/requests-kerberos
|
||||
.. _NTLM: https://github.com/requests/requests-ntlm
|
||||
.. _Requests organization: https://github.com/requests
|
||||
40
docs/user/install.rst
Normal file
40
docs/user/install.rst
Normal file
@@ -0,0 +1,40 @@
|
||||
.. _install:
|
||||
|
||||
Installation of Requests
|
||||
========================
|
||||
|
||||
This part of the documentation covers the installation of Requests.
|
||||
The first step to using any software package is getting it properly installed.
|
||||
|
||||
|
||||
$ pip install requests
|
||||
----------------------
|
||||
|
||||
To install Requests, simply run this simple command in your terminal of choice::
|
||||
|
||||
$ pip install requests
|
||||
|
||||
If you don't have `pip <https://pip.pypa.io>`_ installed (tisk tisk!),
|
||||
`this Python installation guide <http://docs.python-guide.org/en/latest/starting/installation/>`_
|
||||
can guide you through the process.
|
||||
|
||||
Get the Source Code
|
||||
-------------------
|
||||
|
||||
Requests is actively developed on GitHub, where the code is
|
||||
`always available <https://github.com/requests/requests>`_.
|
||||
|
||||
You can either clone the public repository::
|
||||
|
||||
$ git clone git://github.com/requests/requests.git
|
||||
|
||||
Or, download the `tarball <https://github.com/requests/requests/tarball/master>`_::
|
||||
|
||||
$ curl -OL https://github.com/requests/requests/tarball/master
|
||||
# optionally, zipball is also available (for Windows users).
|
||||
|
||||
Once you have a copy of the source, you can embed it in your own Python
|
||||
package, or install it into your site-packages easily::
|
||||
|
||||
$ cd requests
|
||||
$ pip install .
|
||||
45
docs/user/intro.rst
Normal file
45
docs/user/intro.rst
Normal file
@@ -0,0 +1,45 @@
|
||||
.. _introduction:
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
Philosophy
|
||||
----------
|
||||
|
||||
Requests was developed with a few :pep:`20` idioms in mind.
|
||||
|
||||
|
||||
#. Beautiful is better than ugly.
|
||||
#. Explicit is better than implicit.
|
||||
#. Simple is better than complex.
|
||||
#. Complex is better than complicated.
|
||||
#. Readability counts.
|
||||
|
||||
All contributions to Requests should keep these important rules in mind.
|
||||
|
||||
.. _`apache2`:
|
||||
|
||||
Apache2 License
|
||||
---------------
|
||||
|
||||
A large number of open source projects you find today are `GPL Licensed`_.
|
||||
While the GPL has its time and place, it should most certainly not be your
|
||||
go-to license for your next open source project.
|
||||
|
||||
A project that is released as GPL cannot be used in any commercial product
|
||||
without the product itself also being offered as open source.
|
||||
|
||||
The MIT, BSD, ISC, and Apache2 licenses are great alternatives to the GPL
|
||||
that allow your open-source software to be used freely in proprietary,
|
||||
closed-source software.
|
||||
|
||||
Requests is released under terms of `Apache2 License`_.
|
||||
|
||||
.. _`GPL Licensed`: http://www.opensource.org/licenses/gpl-license.php
|
||||
.. _`Apache2 License`: http://opensource.org/licenses/Apache-2.0
|
||||
|
||||
|
||||
Requests License
|
||||
----------------
|
||||
|
||||
.. include:: ../../LICENSE
|
||||
545
docs/user/quickstart.rst
Normal file
545
docs/user/quickstart.rst
Normal file
@@ -0,0 +1,545 @@
|
||||
.. _quickstart:
|
||||
|
||||
Quickstart
|
||||
==========
|
||||
|
||||
.. module:: requests.models
|
||||
|
||||
Eager to get started? This page gives a good introduction in how to get started
|
||||
with Requests.
|
||||
|
||||
First, make sure that:
|
||||
|
||||
* Requests is :ref:`installed <install>`
|
||||
* Requests is :ref:`up-to-date <updates>`
|
||||
|
||||
|
||||
Let's get started with some simple examples.
|
||||
|
||||
|
||||
Make a Request
|
||||
--------------
|
||||
|
||||
Making a request with Requests is very simple.
|
||||
|
||||
Begin by importing the Requests module::
|
||||
|
||||
>>> import requests
|
||||
|
||||
Now, let's try to get a webpage. For this example, let's get GitHub's public
|
||||
timeline::
|
||||
|
||||
>>> r = requests.get('https://api.github.com/events')
|
||||
|
||||
Now, we have a :class:`Response <requests.Response>` object called ``r``. We can
|
||||
get all the information we need from this object.
|
||||
|
||||
Requests' simple API means that all forms of HTTP request are as obvious. For
|
||||
example, this is how you make an HTTP POST request::
|
||||
|
||||
>>> r = requests.post('http://httpbin.org/post', data = {'key':'value'})
|
||||
|
||||
Nice, right? What about the other HTTP request types: PUT, DELETE, HEAD and
|
||||
OPTIONS? These are all just as simple::
|
||||
|
||||
>>> r = requests.put('http://httpbin.org/put', data = {'key':'value'})
|
||||
>>> r = requests.delete('http://httpbin.org/delete')
|
||||
>>> r = requests.head('http://httpbin.org/get')
|
||||
>>> r = requests.options('http://httpbin.org/get')
|
||||
|
||||
That's all well and good, but it's also only the start of what Requests can
|
||||
do.
|
||||
|
||||
|
||||
Passing Parameters In URLs
|
||||
--------------------------
|
||||
|
||||
You often want to send some sort of data in the URL's query string. If
|
||||
you were constructing the URL by hand, this data would be given as key/value
|
||||
pairs in the URL after a question mark, e.g. ``httpbin.org/get?key=val``.
|
||||
Requests allows you to provide these arguments as a dictionary of strings,
|
||||
using the ``params`` keyword argument. As an example, if you wanted to pass
|
||||
``key1=value1`` and ``key2=value2`` to ``httpbin.org/get``, you would use the
|
||||
following code::
|
||||
|
||||
>>> payload = {'key1': 'value1', 'key2': 'value2'}
|
||||
>>> r = requests.get('http://httpbin.org/get', params=payload)
|
||||
|
||||
You can see that the URL has been correctly encoded by printing the URL::
|
||||
|
||||
>>> print(r.url)
|
||||
http://httpbin.org/get?key2=value2&key1=value1
|
||||
|
||||
Note that any dictionary key whose value is ``None`` will not be added to the
|
||||
URL's query string.
|
||||
|
||||
You can also pass a list of items as a value::
|
||||
|
||||
>>> payload = {'key1': 'value1', 'key2': ['value2', 'value3']}
|
||||
|
||||
>>> r = requests.get('http://httpbin.org/get', params=payload)
|
||||
>>> print(r.url)
|
||||
http://httpbin.org/get?key1=value1&key2=value2&key2=value3
|
||||
|
||||
Response Content
|
||||
----------------
|
||||
|
||||
We can read the content of the server's response. Consider the GitHub timeline
|
||||
again::
|
||||
|
||||
>>> import requests
|
||||
|
||||
>>> r = requests.get('https://api.github.com/events')
|
||||
>>> r.text
|
||||
u'[{"repository":{"open_issues":0,"url":"https://github.com/...
|
||||
|
||||
Requests will automatically decode content from the server. Most unicode
|
||||
charsets are seamlessly decoded.
|
||||
|
||||
When you make a request, Requests makes educated guesses about the encoding of
|
||||
the response based on the HTTP headers. The text encoding guessed by Requests
|
||||
is used when you access ``r.text``. You can find out what encoding Requests is
|
||||
using, and change it, using the ``r.encoding`` property::
|
||||
|
||||
>>> r.encoding
|
||||
'utf-8'
|
||||
>>> r.encoding = 'ISO-8859-1'
|
||||
|
||||
If you change the encoding, Requests will use the new value of ``r.encoding``
|
||||
whenever you call ``r.text``. You might want to do this in any situation where
|
||||
you can apply special logic to work out what the encoding of the content will
|
||||
be. For example, HTTP and XML have the ability to specify their encoding in
|
||||
their body. In situations like this, you should use ``r.content`` to find the
|
||||
encoding, and then set ``r.encoding``. This will let you use ``r.text`` with
|
||||
the correct encoding.
|
||||
|
||||
Requests will also use custom encodings in the event that you need them. If
|
||||
you have created your own encoding and registered it with the ``codecs``
|
||||
module, you can simply use the codec name as the value of ``r.encoding`` and
|
||||
Requests will handle the decoding for you.
|
||||
|
||||
Binary Response Content
|
||||
-----------------------
|
||||
|
||||
You can also access the response body as bytes, for non-text requests::
|
||||
|
||||
>>> r.content
|
||||
b'[{"repository":{"open_issues":0,"url":"https://github.com/...
|
||||
|
||||
The ``gzip`` and ``deflate`` transfer-encodings are automatically decoded for you.
|
||||
|
||||
For example, to create an image from binary data returned by a request, you can
|
||||
use the following code::
|
||||
|
||||
>>> from PIL import Image
|
||||
>>> from io import BytesIO
|
||||
|
||||
>>> i = Image.open(BytesIO(r.content))
|
||||
|
||||
|
||||
JSON Response Content
|
||||
---------------------
|
||||
|
||||
There's also a builtin JSON decoder, in case you're dealing with JSON data::
|
||||
|
||||
>>> import requests
|
||||
|
||||
>>> r = requests.get('https://api.github.com/events')
|
||||
>>> r.json()
|
||||
[{u'repository': {u'open_issues': 0, u'url': 'https://github.com/...
|
||||
|
||||
In case the JSON decoding fails, ``r.json()`` raises an exception. For example, if
|
||||
the response gets a 204 (No Content), or if the response contains invalid JSON,
|
||||
attempting ``r.json()`` raises ``ValueError: No JSON object could be decoded``.
|
||||
|
||||
It should be noted that the success of the call to ``r.json()`` does **not**
|
||||
indicate the success of the response. Some servers may return a JSON object in a
|
||||
failed response (e.g. error details with HTTP 500). Such JSON will be decoded
|
||||
and returned. To check that a request is successful, use
|
||||
``r.raise_for_status()`` or check ``r.status_code`` is what you expect.
|
||||
|
||||
|
||||
Raw Response Content
|
||||
--------------------
|
||||
|
||||
In the rare case that you'd like to get the raw socket response from the
|
||||
server, you can access ``r.raw``. If you want to do this, make sure you set
|
||||
``stream=True`` in your initial request. Once you do, you can do this::
|
||||
|
||||
>>> r = requests.get('https://api.github.com/events', stream=True)
|
||||
|
||||
>>> r.raw
|
||||
<requests.packages.urllib3.response.HTTPResponse object at 0x101194810>
|
||||
|
||||
>>> r.raw.read(10)
|
||||
'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03'
|
||||
|
||||
In general, however, you should use a pattern like this to save what is being
|
||||
streamed to a file::
|
||||
|
||||
with open(filename, 'wb') as fd:
|
||||
for chunk in r.iter_content(chunk_size=128):
|
||||
fd.write(chunk)
|
||||
|
||||
Using ``Response.iter_content`` will handle a lot of what you would otherwise
|
||||
have to handle when using ``Response.raw`` directly. When streaming a
|
||||
download, the above is the preferred and recommended way to retrieve the
|
||||
content. Note that ``chunk_size`` can be freely adjusted to a number that
|
||||
may better fit your use cases.
|
||||
|
||||
|
||||
Custom Headers
|
||||
--------------
|
||||
|
||||
If you'd like to add HTTP headers to a request, simply pass in a ``dict`` to the
|
||||
``headers`` parameter.
|
||||
|
||||
For example, we didn't specify our user-agent in the previous example::
|
||||
|
||||
>>> url = 'https://api.github.com/some/endpoint'
|
||||
>>> headers = {'user-agent': 'my-app/0.0.1'}
|
||||
|
||||
>>> r = requests.get(url, headers=headers)
|
||||
|
||||
Note: Custom headers are given less precedence than more specific sources of information. For instance:
|
||||
|
||||
* Authorization headers set with `headers=` will be overridden if credentials
|
||||
are specified in ``.netrc``, which in turn will be overridden by the ``auth=``
|
||||
parameter.
|
||||
* Authorization headers will be removed if you get redirected off-host.
|
||||
* Proxy-Authorization headers will be overridden by proxy credentials provided in the URL.
|
||||
* Content-Length headers will be overridden when we can determine the length of the content.
|
||||
|
||||
Furthermore, Requests does not change its behavior at all based on which custom headers are specified. The headers are simply passed on into the final request.
|
||||
|
||||
Note: All header values must be a ``string``, bytestring, or unicode. While permitted, it's advised to avoid passing unicode header values.
|
||||
|
||||
More complicated POST requests
|
||||
------------------------------
|
||||
|
||||
Typically, you want to send some form-encoded data — much like an HTML form.
|
||||
To do this, simply pass a dictionary to the ``data`` argument. Your
|
||||
dictionary of data will automatically be form-encoded when the request is made::
|
||||
|
||||
>>> payload = {'key1': 'value1', 'key2': 'value2'}
|
||||
|
||||
>>> r = requests.post("http://httpbin.org/post", data=payload)
|
||||
>>> print(r.text)
|
||||
{
|
||||
...
|
||||
"form": {
|
||||
"key2": "value2",
|
||||
"key1": "value1"
|
||||
},
|
||||
...
|
||||
}
|
||||
|
||||
You can also pass a list of tuples to the ``data`` argument. This is particularly
|
||||
useful when the form has multiple elements that use the same key::
|
||||
|
||||
>>> payload = (('key1', 'value1'), ('key1', 'value2'))
|
||||
>>> r = requests.post('http://httpbin.org/post', data=payload)
|
||||
>>> print(r.text)
|
||||
{
|
||||
...
|
||||
"form": {
|
||||
"key1": [
|
||||
"value1",
|
||||
"value2"
|
||||
]
|
||||
},
|
||||
...
|
||||
}
|
||||
|
||||
There are times that you may want to send data that is not form-encoded. If
|
||||
you pass in a ``string`` instead of a ``dict``, that data will be posted directly.
|
||||
|
||||
For example, the GitHub API v3 accepts JSON-Encoded POST/PATCH data::
|
||||
|
||||
>>> import json
|
||||
|
||||
>>> url = 'https://api.github.com/some/endpoint'
|
||||
>>> payload = {'some': 'data'}
|
||||
|
||||
>>> r = requests.post(url, data=json.dumps(payload))
|
||||
|
||||
Instead of encoding the ``dict`` yourself, you can also pass it directly using
|
||||
the ``json`` parameter (added in version 2.4.2) and it will be encoded automatically::
|
||||
|
||||
>>> url = 'https://api.github.com/some/endpoint'
|
||||
>>> payload = {'some': 'data'}
|
||||
|
||||
>>> r = requests.post(url, json=payload)
|
||||
|
||||
|
||||
POST a Multipart-Encoded File
|
||||
-----------------------------
|
||||
|
||||
Requests makes it simple to upload Multipart-encoded files::
|
||||
|
||||
>>> url = 'http://httpbin.org/post'
|
||||
>>> files = {'file': open('report.xls', 'rb')}
|
||||
|
||||
>>> r = requests.post(url, files=files)
|
||||
>>> r.text
|
||||
{
|
||||
...
|
||||
"files": {
|
||||
"file": "<censored...binary...data>"
|
||||
},
|
||||
...
|
||||
}
|
||||
|
||||
You can set the filename, content_type and headers explicitly::
|
||||
|
||||
>>> url = 'http://httpbin.org/post'
|
||||
>>> files = {'file': ('report.xls', open('report.xls', 'rb'), 'application/vnd.ms-excel', {'Expires': '0'})}
|
||||
|
||||
>>> r = requests.post(url, files=files)
|
||||
>>> r.text
|
||||
{
|
||||
...
|
||||
"files": {
|
||||
"file": "<censored...binary...data>"
|
||||
},
|
||||
...
|
||||
}
|
||||
|
||||
If you want, you can send strings to be received as files::
|
||||
|
||||
>>> url = 'http://httpbin.org/post'
|
||||
>>> files = {'file': ('report.csv', 'some,data,to,send\nanother,row,to,send\n')}
|
||||
|
||||
>>> r = requests.post(url, files=files)
|
||||
>>> r.text
|
||||
{
|
||||
...
|
||||
"files": {
|
||||
"file": "some,data,to,send\\nanother,row,to,send\\n"
|
||||
},
|
||||
...
|
||||
}
|
||||
|
||||
In the event you are posting a very large file as a ``multipart/form-data``
|
||||
request, you may want to stream the request. By default, ``requests`` does not
|
||||
support this, but there is a separate package which does -
|
||||
``requests-toolbelt``. You should read `the toolbelt's documentation
|
||||
<https://toolbelt.readthedocs.io>`_ for more details about how to use it.
|
||||
|
||||
For sending multiple files in one request refer to the :ref:`advanced <advanced>`
|
||||
section.
|
||||
|
||||
.. warning:: It is strongly recommended that you open files in `binary mode`_.
|
||||
This is because Requests may attempt to provide the
|
||||
``Content-Length`` header for you, and if it does this value will
|
||||
be set to the number of *bytes* in the file. Errors may occur if
|
||||
you open the file in *text mode*.
|
||||
|
||||
.. _binary mode: https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files
|
||||
|
||||
|
||||
Response Status Codes
|
||||
---------------------
|
||||
|
||||
We can check the response status code::
|
||||
|
||||
>>> r = requests.get('http://httpbin.org/get')
|
||||
>>> r.status_code
|
||||
200
|
||||
|
||||
Requests also comes with a built-in status code lookup object for easy
|
||||
reference::
|
||||
|
||||
>>> r.status_code == requests.codes.ok
|
||||
True
|
||||
|
||||
If we made a bad request (a 4XX client error or 5XX server error response), we
|
||||
can raise it with
|
||||
:meth:`Response.raise_for_status() <requests.Response.raise_for_status>`::
|
||||
|
||||
>>> bad_r = requests.get('http://httpbin.org/status/404')
|
||||
>>> bad_r.status_code
|
||||
404
|
||||
|
||||
>>> bad_r.raise_for_status()
|
||||
Traceback (most recent call last):
|
||||
File "requests/models.py", line 832, in raise_for_status
|
||||
raise http_error
|
||||
requests.exceptions.HTTPError: 404 Client Error
|
||||
|
||||
But, since our ``status_code`` for ``r`` was ``200``, when we call
|
||||
``raise_for_status()`` we get::
|
||||
|
||||
>>> r.raise_for_status()
|
||||
None
|
||||
|
||||
All is well.
|
||||
|
||||
|
||||
Response Headers
|
||||
----------------
|
||||
|
||||
We can view the server's response headers using a Python dictionary::
|
||||
|
||||
>>> r.headers
|
||||
{
|
||||
'content-encoding': 'gzip',
|
||||
'transfer-encoding': 'chunked',
|
||||
'connection': 'close',
|
||||
'server': 'nginx/1.0.4',
|
||||
'x-runtime': '148ms',
|
||||
'etag': '"e1ca502697e5c9317743dc078f67693f"',
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
|
||||
The dictionary is special, though: it's made just for HTTP headers. According to
|
||||
`RFC 7230 <http://tools.ietf.org/html/rfc7230#section-3.2>`_, HTTP Header names
|
||||
are case-insensitive.
|
||||
|
||||
So, we can access the headers using any capitalization we want::
|
||||
|
||||
>>> r.headers['Content-Type']
|
||||
'application/json'
|
||||
|
||||
>>> r.headers.get('content-type')
|
||||
'application/json'
|
||||
|
||||
It is also special in that the server could have sent the same header multiple
|
||||
times with different values, but requests combines them so they can be
|
||||
represented in the dictionary within a single mapping, as per
|
||||
`RFC 7230 <http://tools.ietf.org/html/rfc7230#section-3.2>`_:
|
||||
|
||||
A recipient MAY combine multiple header fields with the same field name
|
||||
into one "field-name: field-value" pair, without changing the semantics
|
||||
of the message, by appending each subsequent field value to the combined
|
||||
field value in order, separated by a comma.
|
||||
|
||||
Cookies
|
||||
-------
|
||||
|
||||
If a response contains some Cookies, you can quickly access them::
|
||||
|
||||
>>> url = 'http://example.com/some/cookie/setting/url'
|
||||
>>> r = requests.get(url)
|
||||
|
||||
>>> r.cookies['example_cookie_name']
|
||||
'example_cookie_value'
|
||||
|
||||
To send your own cookies to the server, you can use the ``cookies``
|
||||
parameter::
|
||||
|
||||
>>> url = 'http://httpbin.org/cookies'
|
||||
>>> cookies = dict(cookies_are='working')
|
||||
|
||||
>>> r = requests.get(url, cookies=cookies)
|
||||
>>> r.text
|
||||
'{"cookies": {"cookies_are": "working"}}'
|
||||
|
||||
Cookies are returned in a :class:`~requests.cookies.RequestsCookieJar`,
|
||||
which acts like a ``dict`` but also offers a more complete interface,
|
||||
suitable for use over multiple domains or paths. Cookie jars can
|
||||
also be passed in to requests::
|
||||
|
||||
>>> jar = requests.cookies.RequestsCookieJar()
|
||||
>>> jar.set('tasty_cookie', 'yum', domain='httpbin.org', path='/cookies')
|
||||
>>> jar.set('gross_cookie', 'blech', domain='httpbin.org', path='/elsewhere')
|
||||
>>> url = 'http://httpbin.org/cookies'
|
||||
>>> r = requests.get(url, cookies=jar)
|
||||
>>> r.text
|
||||
'{"cookies": {"tasty_cookie": "yum"}}'
|
||||
|
||||
|
||||
Redirection and History
|
||||
-----------------------
|
||||
|
||||
By default Requests will perform location redirection for all verbs except
|
||||
HEAD.
|
||||
|
||||
We can use the ``history`` property of the Response object to track redirection.
|
||||
|
||||
The :attr:`Response.history <requests.Response.history>` list contains the
|
||||
:class:`Response <requests.Response>` objects that were created in order to
|
||||
complete the request. The list is sorted from the oldest to the most recent
|
||||
response.
|
||||
|
||||
For example, GitHub redirects all HTTP requests to HTTPS::
|
||||
|
||||
>>> r = requests.get('http://github.com')
|
||||
|
||||
>>> r.url
|
||||
'https://github.com/'
|
||||
|
||||
>>> r.status_code
|
||||
200
|
||||
|
||||
>>> r.history
|
||||
[<Response [301]>]
|
||||
|
||||
|
||||
If you're using GET, OPTIONS, POST, PUT, PATCH or DELETE, you can disable
|
||||
redirection handling with the ``allow_redirects`` parameter::
|
||||
|
||||
>>> r = requests.get('http://github.com', allow_redirects=False)
|
||||
|
||||
>>> r.status_code
|
||||
301
|
||||
|
||||
>>> r.history
|
||||
[]
|
||||
|
||||
If you're using HEAD, you can enable redirection as well::
|
||||
|
||||
>>> r = requests.head('http://github.com', allow_redirects=True)
|
||||
|
||||
>>> r.url
|
||||
'https://github.com/'
|
||||
|
||||
>>> r.history
|
||||
[<Response [301]>]
|
||||
|
||||
|
||||
Timeouts
|
||||
--------
|
||||
|
||||
You can tell Requests to stop waiting for a response after a given number of
|
||||
seconds with the ``timeout`` parameter. Nearly all production code should use
|
||||
this parameter in nearly all requests. Failure to do so can cause your program
|
||||
to hang indefinitely::
|
||||
|
||||
>>> requests.get('http://github.com', timeout=0.001)
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in <module>
|
||||
requests.exceptions.Timeout: HTTPConnectionPool(host='github.com', port=80): Request timed out. (timeout=0.001)
|
||||
|
||||
|
||||
.. admonition:: Note
|
||||
|
||||
``timeout`` is not a time limit on the entire response download;
|
||||
rather, an exception is raised if the server has not issued a
|
||||
response for ``timeout`` seconds (more precisely, if no bytes have been
|
||||
received on the underlying socket for ``timeout`` seconds). If no timeout is specified explicitly, requests do
|
||||
not time out.
|
||||
|
||||
|
||||
Errors and Exceptions
|
||||
---------------------
|
||||
|
||||
In the event of a network problem (e.g. DNS failure, refused connection, etc),
|
||||
Requests will raise a :exc:`~requests.exceptions.ConnectionError` exception.
|
||||
|
||||
:meth:`Response.raise_for_status() <requests.Response.raise_for_status>` will
|
||||
raise an :exc:`~requests.exceptions.HTTPError` if the HTTP request
|
||||
returned an unsuccessful status code.
|
||||
|
||||
If a request times out, a :exc:`~requests.exceptions.Timeout` exception is
|
||||
raised.
|
||||
|
||||
If a request exceeds the configured number of maximum redirections, a
|
||||
:exc:`~requests.exceptions.TooManyRedirects` exception is raised.
|
||||
|
||||
All exceptions that Requests explicitly raises inherit from
|
||||
:exc:`requests.exceptions.RequestException`.
|
||||
|
||||
-----------------------
|
||||
|
||||
Ready for more? Check out the :ref:`advanced <advanced>` section.
|
||||
8722
ext/requests-logo.ai
Normal file
8722
ext/requests-logo.ai
Normal file
File diff suppressed because one or more lines are too long
1
ext/requests-logo.svg
Normal file
1
ext/requests-logo.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 863 KiB |
2
pytest.ini
Normal file
2
pytest.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
addopts = -p no:warnings
|
||||
@@ -1,4 +1,121 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# __
|
||||
# /__) _ _ _ _ _/ _
|
||||
# / ( (- (/ (/ (- _) / _)
|
||||
# /
|
||||
|
||||
"""
|
||||
Requests HTTP Library
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Requests is an HTTP library, written in Python, for human beings. Basic GET
|
||||
usage:
|
||||
|
||||
>>> import requests
|
||||
>>> r = requests.get('https://www.python.org')
|
||||
>>> r.status_code
|
||||
200
|
||||
>>> 'Python is a programming language' in r.content
|
||||
True
|
||||
|
||||
... or POST:
|
||||
|
||||
>>> payload = dict(key1='value1', key2='value2')
|
||||
>>> r = requests.post('http://httpbin.org/post', data=payload)
|
||||
>>> print(r.text)
|
||||
{
|
||||
...
|
||||
"form": {
|
||||
"key2": "value2",
|
||||
"key1": "value1"
|
||||
},
|
||||
...
|
||||
}
|
||||
|
||||
The other HTTP methods are supported - see `requests.api`. Full documentation
|
||||
is at <http://python-requests.org>.
|
||||
|
||||
:copyright: (c) 2017 by Kenneth Reitz.
|
||||
:license: Apache 2.0, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
import urllib3
|
||||
import chardet
|
||||
import warnings
|
||||
from .exceptions import RequestsDependencyWarning
|
||||
|
||||
|
||||
def check_compatibility(urllib3_version, chardet_version):
|
||||
urllib3_version = urllib3_version.split('.')
|
||||
assert urllib3_version != ['dev'] # Verify urllib3 isn't installed from git.
|
||||
|
||||
# Sometimes, urllib3 only reports its version as 16.1.
|
||||
if len(urllib3_version) == 2:
|
||||
urllib3_version.append('0')
|
||||
|
||||
# Check urllib3 for compatibility.
|
||||
major, minor, patch = urllib3_version # noqa: F811
|
||||
major, minor, patch = int(major), int(minor), int(patch)
|
||||
# urllib3 >= 1.21.1, <= 1.22
|
||||
assert major == 1
|
||||
assert minor >= 21
|
||||
assert minor <= 22
|
||||
|
||||
# Check chardet for compatibility.
|
||||
major, minor, patch = chardet_version.split('.')[:3]
|
||||
major, minor, patch = int(major), int(minor), int(patch)
|
||||
# chardet >= 3.0.2, < 3.1.0
|
||||
assert major == 3
|
||||
assert minor < 1
|
||||
assert patch >= 2
|
||||
|
||||
|
||||
# Check imported dependencies for compatibility.
|
||||
try:
|
||||
check_compatibility(urllib3.__version__, chardet.__version__)
|
||||
except (AssertionError, ValueError):
|
||||
warnings.warn("urllib3 ({0}) or chardet ({1}) doesn't match a supported "
|
||||
"version!".format(urllib3.__version__, chardet.__version__),
|
||||
RequestsDependencyWarning)
|
||||
|
||||
# Attempt to enable urllib3's SNI support, if possible
|
||||
try:
|
||||
from urllib3.contrib import pyopenssl
|
||||
pyopenssl.inject_into_urllib3()
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# urllib3's DependencyWarnings should be silenced.
|
||||
from urllib3.exceptions import DependencyWarning
|
||||
warnings.simplefilter('ignore', DependencyWarning)
|
||||
|
||||
from .__version__ import __title__, __description__, __url__, __version__
|
||||
from .__version__ import __build__, __author__, __author_email__, __license__
|
||||
from .__version__ import __copyright__, __cake__
|
||||
|
||||
from . import utils
|
||||
from . import packages
|
||||
from .core import *
|
||||
from .models import Request, Response, PreparedRequest
|
||||
from .api import request, get, head, post, patch, put, delete, options
|
||||
from .sessions import session, Session
|
||||
from .status_codes import codes
|
||||
from .exceptions import (
|
||||
RequestException, Timeout, URLRequired,
|
||||
TooManyRedirects, HTTPError, ConnectionError,
|
||||
FileModeWarning, ConnectTimeout, ReadTimeout
|
||||
)
|
||||
|
||||
# Set default logging handler to avoid "No handler found" warnings.
|
||||
import logging
|
||||
try: # Python 2.7+
|
||||
from logging import NullHandler
|
||||
except ImportError:
|
||||
class NullHandler(logging.Handler):
|
||||
def emit(self, record):
|
||||
pass
|
||||
|
||||
logging.getLogger(__name__).addHandler(NullHandler())
|
||||
|
||||
# FileModeWarnings go off per the default.
|
||||
warnings.simplefilter('default', FileModeWarning, append=True)
|
||||
|
||||
14
requests/__version__.py
Normal file
14
requests/__version__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# .-. .-. .-. . . .-. .-. .-. .-.
|
||||
# |( |- |.| | | |- `-. | `-.
|
||||
# ' ' `-' `-`.`-' `-' `-' ' `-'
|
||||
|
||||
__title__ = 'requests'
|
||||
__description__ = 'Python HTTP for Humans.'
|
||||
__url__ = 'http://python-requests.org'
|
||||
__version__ = '2.18.4'
|
||||
__build__ = 0x021804
|
||||
__author__ = 'Kenneth Reitz'
|
||||
__author_email__ = 'me@kennethreitz.org'
|
||||
__license__ = 'Apache 2.0'
|
||||
__copyright__ = 'Copyright 2017 Kenneth Reitz'
|
||||
__cake__ = u'\u2728 \U0001f370 \u2728'
|
||||
42
requests/_internal_utils.py
Normal file
42
requests/_internal_utils.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests._internal_utils
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Provides utility functions that are consumed internally by Requests
|
||||
which depend on extremely few external helpers (such as compat)
|
||||
"""
|
||||
|
||||
from .compat import is_py2, builtin_str, str
|
||||
|
||||
|
||||
def to_native_string(string, encoding='ascii'):
|
||||
"""Given a string object, regardless of type, returns a representation of
|
||||
that string in the native string type, encoding and decoding where
|
||||
necessary. This assumes ASCII unless told otherwise.
|
||||
"""
|
||||
if isinstance(string, builtin_str):
|
||||
out = string
|
||||
else:
|
||||
if is_py2:
|
||||
out = string.encode(encoding)
|
||||
else:
|
||||
out = string.decode(encoding)
|
||||
|
||||
return out
|
||||
|
||||
|
||||
def unicode_is_ascii(u_string):
|
||||
"""Determine if unicode string only contains ASCII characters.
|
||||
|
||||
:param str u_string: unicode string to check. Must be unicode
|
||||
and not Python 2 `str`.
|
||||
:rtype: bool
|
||||
"""
|
||||
assert isinstance(u_string, str)
|
||||
try:
|
||||
u_string.encode('ascii')
|
||||
return True
|
||||
except UnicodeEncodeError:
|
||||
return False
|
||||
525
requests/adapters.py
Normal file
525
requests/adapters.py
Normal file
@@ -0,0 +1,525 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.adapters
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
This module contains the transport adapters that Requests uses to define
|
||||
and maintain connections.
|
||||
"""
|
||||
|
||||
import os.path
|
||||
import socket
|
||||
|
||||
from urllib3.poolmanager import PoolManager, proxy_from_url
|
||||
from urllib3.response import HTTPResponse
|
||||
from urllib3.util import Timeout as TimeoutSauce
|
||||
from urllib3.util.retry import Retry
|
||||
from urllib3.exceptions import ClosedPoolError
|
||||
from urllib3.exceptions import ConnectTimeoutError
|
||||
from urllib3.exceptions import HTTPError as _HTTPError
|
||||
from urllib3.exceptions import MaxRetryError
|
||||
from urllib3.exceptions import NewConnectionError
|
||||
from urllib3.exceptions import ProxyError as _ProxyError
|
||||
from urllib3.exceptions import ProtocolError
|
||||
from urllib3.exceptions import ReadTimeoutError
|
||||
from urllib3.exceptions import SSLError as _SSLError
|
||||
from urllib3.exceptions import ResponseError
|
||||
|
||||
from .models import Response
|
||||
from .compat import urlparse, basestring
|
||||
from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
|
||||
prepend_scheme_if_needed, get_auth_from_url, urldefragauth,
|
||||
select_proxy)
|
||||
from .structures import CaseInsensitiveDict
|
||||
from .cookies import extract_cookies_to_jar
|
||||
from .exceptions import (ConnectionError, ConnectTimeout, ReadTimeout, SSLError,
|
||||
ProxyError, RetryError, InvalidSchema)
|
||||
from .auth import _basic_auth_str
|
||||
|
||||
try:
|
||||
from urllib3.contrib.socks import SOCKSProxyManager
|
||||
except ImportError:
|
||||
def SOCKSProxyManager(*args, **kwargs):
|
||||
raise InvalidSchema("Missing dependencies for SOCKS support.")
|
||||
|
||||
DEFAULT_POOLBLOCK = False
|
||||
DEFAULT_POOLSIZE = 10
|
||||
DEFAULT_RETRIES = 0
|
||||
DEFAULT_POOL_TIMEOUT = None
|
||||
|
||||
|
||||
class BaseAdapter(object):
|
||||
"""The Base Transport Adapter"""
|
||||
|
||||
def __init__(self):
|
||||
super(BaseAdapter, self).__init__()
|
||||
|
||||
def send(self, request, stream=False, timeout=None, verify=True,
|
||||
cert=None, proxies=None):
|
||||
"""Sends PreparedRequest object. Returns Response object.
|
||||
|
||||
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
|
||||
:param stream: (optional) Whether to stream the request content.
|
||||
:param timeout: (optional) How long to wait for the server to send
|
||||
data before giving up, as a float, or a :ref:`(connect timeout,
|
||||
read timeout) <timeouts>` tuple.
|
||||
:type timeout: float or tuple
|
||||
:param verify: (optional) Either a boolean, in which case it controls whether we verify
|
||||
the server's TLS certificate, or a string, in which case it must be a path
|
||||
to a CA bundle to use
|
||||
:param cert: (optional) Any user-provided SSL certificate to be trusted.
|
||||
:param proxies: (optional) The proxies dictionary to apply to the request.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def close(self):
|
||||
"""Cleans up adapter specific items."""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class HTTPAdapter(BaseAdapter):
|
||||
"""The built-in HTTP Adapter for urllib3.
|
||||
|
||||
Provides a general-case interface for Requests sessions to contact HTTP and
|
||||
HTTPS urls by implementing the Transport Adapter interface. This class will
|
||||
usually be created by the :class:`Session <Session>` class under the
|
||||
covers.
|
||||
|
||||
:param pool_connections: The number of urllib3 connection pools to cache.
|
||||
:param pool_maxsize: The maximum number of connections to save in the pool.
|
||||
:param max_retries: The maximum number of retries each connection
|
||||
should attempt. Note, this applies only to failed DNS lookups, socket
|
||||
connections and connection timeouts, never to requests where data has
|
||||
made it to the server. By default, Requests does not retry failed
|
||||
connections. If you need granular control over the conditions under
|
||||
which we retry a request, import urllib3's ``Retry`` class and pass
|
||||
that instead.
|
||||
:param pool_block: Whether the connection pool should block for connections.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> import requests
|
||||
>>> s = requests.Session()
|
||||
>>> a = requests.adapters.HTTPAdapter(max_retries=3)
|
||||
>>> s.mount('http://', a)
|
||||
"""
|
||||
__attrs__ = ['max_retries', 'config', '_pool_connections', '_pool_maxsize',
|
||||
'_pool_block']
|
||||
|
||||
def __init__(self, pool_connections=DEFAULT_POOLSIZE,
|
||||
pool_maxsize=DEFAULT_POOLSIZE, max_retries=DEFAULT_RETRIES,
|
||||
pool_block=DEFAULT_POOLBLOCK):
|
||||
if max_retries == DEFAULT_RETRIES:
|
||||
self.max_retries = Retry(0, read=False)
|
||||
else:
|
||||
self.max_retries = Retry.from_int(max_retries)
|
||||
self.config = {}
|
||||
self.proxy_manager = {}
|
||||
|
||||
super(HTTPAdapter, self).__init__()
|
||||
|
||||
self._pool_connections = pool_connections
|
||||
self._pool_maxsize = pool_maxsize
|
||||
self._pool_block = pool_block
|
||||
|
||||
self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block)
|
||||
|
||||
def __getstate__(self):
|
||||
return dict((attr, getattr(self, attr, None)) for attr in
|
||||
self.__attrs__)
|
||||
|
||||
def __setstate__(self, state):
|
||||
# Can't handle by adding 'proxy_manager' to self.__attrs__ because
|
||||
# self.poolmanager uses a lambda function, which isn't pickleable.
|
||||
self.proxy_manager = {}
|
||||
self.config = {}
|
||||
|
||||
for attr, value in state.items():
|
||||
setattr(self, attr, value)
|
||||
|
||||
self.init_poolmanager(self._pool_connections, self._pool_maxsize,
|
||||
block=self._pool_block)
|
||||
|
||||
def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs):
|
||||
"""Initializes a urllib3 PoolManager.
|
||||
|
||||
This method should not be called from user code, and is only
|
||||
exposed for use when subclassing the
|
||||
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
||||
|
||||
:param connections: The number of urllib3 connection pools to cache.
|
||||
:param maxsize: The maximum number of connections to save in the pool.
|
||||
:param block: Block when no free connections are available.
|
||||
:param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager.
|
||||
"""
|
||||
# save these values for pickling
|
||||
self._pool_connections = connections
|
||||
self._pool_maxsize = maxsize
|
||||
self._pool_block = block
|
||||
|
||||
self.poolmanager = PoolManager(num_pools=connections, maxsize=maxsize,
|
||||
block=block, strict=True, **pool_kwargs)
|
||||
|
||||
def proxy_manager_for(self, proxy, **proxy_kwargs):
|
||||
"""Return urllib3 ProxyManager for the given proxy.
|
||||
|
||||
This method should not be called from user code, and is only
|
||||
exposed for use when subclassing the
|
||||
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
||||
|
||||
:param proxy: The proxy to return a urllib3 ProxyManager for.
|
||||
:param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager.
|
||||
:returns: ProxyManager
|
||||
:rtype: urllib3.ProxyManager
|
||||
"""
|
||||
if proxy in self.proxy_manager:
|
||||
manager = self.proxy_manager[proxy]
|
||||
elif proxy.lower().startswith('socks'):
|
||||
username, password = get_auth_from_url(proxy)
|
||||
manager = self.proxy_manager[proxy] = SOCKSProxyManager(
|
||||
proxy,
|
||||
username=username,
|
||||
password=password,
|
||||
num_pools=self._pool_connections,
|
||||
maxsize=self._pool_maxsize,
|
||||
block=self._pool_block,
|
||||
**proxy_kwargs
|
||||
)
|
||||
else:
|
||||
proxy_headers = self.proxy_headers(proxy)
|
||||
manager = self.proxy_manager[proxy] = proxy_from_url(
|
||||
proxy,
|
||||
proxy_headers=proxy_headers,
|
||||
num_pools=self._pool_connections,
|
||||
maxsize=self._pool_maxsize,
|
||||
block=self._pool_block,
|
||||
**proxy_kwargs)
|
||||
|
||||
return manager
|
||||
|
||||
def cert_verify(self, conn, url, verify, cert):
|
||||
"""Verify a SSL certificate. This method should not be called from user
|
||||
code, and is only exposed for use when subclassing the
|
||||
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
||||
|
||||
:param conn: The urllib3 connection object associated with the cert.
|
||||
:param url: The requested URL.
|
||||
:param verify: Either a boolean, in which case it controls whether we verify
|
||||
the server's TLS certificate, or a string, in which case it must be a path
|
||||
to a CA bundle to use
|
||||
:param cert: The SSL certificate to verify.
|
||||
"""
|
||||
if url.lower().startswith('https') and verify:
|
||||
|
||||
cert_loc = None
|
||||
|
||||
# Allow self-specified cert location.
|
||||
if verify is not True:
|
||||
cert_loc = verify
|
||||
|
||||
if not cert_loc:
|
||||
cert_loc = DEFAULT_CA_BUNDLE_PATH
|
||||
|
||||
if not cert_loc or not os.path.exists(cert_loc):
|
||||
raise IOError("Could not find a suitable TLS CA certificate bundle, "
|
||||
"invalid path: {0}".format(cert_loc))
|
||||
|
||||
conn.cert_reqs = 'CERT_REQUIRED'
|
||||
|
||||
if not os.path.isdir(cert_loc):
|
||||
conn.ca_certs = cert_loc
|
||||
else:
|
||||
conn.ca_cert_dir = cert_loc
|
||||
else:
|
||||
conn.cert_reqs = 'CERT_NONE'
|
||||
conn.ca_certs = None
|
||||
conn.ca_cert_dir = None
|
||||
|
||||
if cert:
|
||||
if not isinstance(cert, basestring):
|
||||
conn.cert_file = cert[0]
|
||||
conn.key_file = cert[1]
|
||||
else:
|
||||
conn.cert_file = cert
|
||||
conn.key_file = None
|
||||
if conn.cert_file and not os.path.exists(conn.cert_file):
|
||||
raise IOError("Could not find the TLS certificate file, "
|
||||
"invalid path: {0}".format(conn.cert_file))
|
||||
if conn.key_file and not os.path.exists(conn.key_file):
|
||||
raise IOError("Could not find the TLS key file, "
|
||||
"invalid path: {0}".format(conn.key_file))
|
||||
|
||||
def build_response(self, req, resp):
|
||||
"""Builds a :class:`Response <requests.Response>` object from a urllib3
|
||||
response. This should not be called from user code, and is only exposed
|
||||
for use when subclassing the
|
||||
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`
|
||||
|
||||
:param req: The :class:`PreparedRequest <PreparedRequest>` used to generate the response.
|
||||
:param resp: The urllib3 response object.
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
response = Response()
|
||||
|
||||
# Fallback to None if there's no status_code, for whatever reason.
|
||||
response.status_code = getattr(resp, 'status', None)
|
||||
|
||||
# Make headers case-insensitive.
|
||||
response.headers = CaseInsensitiveDict(getattr(resp, 'headers', {}))
|
||||
|
||||
# Set encoding.
|
||||
response.encoding = get_encoding_from_headers(response.headers)
|
||||
response.raw = resp
|
||||
response.reason = response.raw.reason
|
||||
|
||||
if isinstance(req.url, bytes):
|
||||
response.url = req.url.decode('utf-8')
|
||||
else:
|
||||
response.url = req.url
|
||||
|
||||
# Add new cookies from the server.
|
||||
extract_cookies_to_jar(response.cookies, req, resp)
|
||||
|
||||
# Give the Response some context.
|
||||
response.request = req
|
||||
response.connection = self
|
||||
|
||||
return response
|
||||
|
||||
def get_connection(self, url, proxies=None):
|
||||
"""Returns a urllib3 connection for the given URL. This should not be
|
||||
called from user code, and is only exposed for use when subclassing the
|
||||
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
||||
|
||||
:param url: The URL to connect to.
|
||||
:param proxies: (optional) A Requests-style dictionary of proxies used on this request.
|
||||
:rtype: urllib3.ConnectionPool
|
||||
"""
|
||||
proxy = select_proxy(url, proxies)
|
||||
|
||||
if proxy:
|
||||
proxy = prepend_scheme_if_needed(proxy, 'http')
|
||||
proxy_manager = self.proxy_manager_for(proxy)
|
||||
conn = proxy_manager.connection_from_url(url)
|
||||
else:
|
||||
# Only scheme should be lower case
|
||||
parsed = urlparse(url)
|
||||
url = parsed.geturl()
|
||||
conn = self.poolmanager.connection_from_url(url)
|
||||
|
||||
return conn
|
||||
|
||||
def close(self):
|
||||
"""Disposes of any internal state.
|
||||
|
||||
Currently, this closes the PoolManager and any active ProxyManager,
|
||||
which closes any pooled connections.
|
||||
"""
|
||||
self.poolmanager.clear()
|
||||
for proxy in self.proxy_manager.values():
|
||||
proxy.clear()
|
||||
|
||||
def request_url(self, request, proxies):
|
||||
"""Obtain the url to use when making the final request.
|
||||
|
||||
If the message is being sent through a HTTP proxy, the full URL has to
|
||||
be used. Otherwise, we should only use the path portion of the URL.
|
||||
|
||||
This should not be called from user code, and is only exposed for use
|
||||
when subclassing the
|
||||
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
||||
|
||||
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
|
||||
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs.
|
||||
:rtype: str
|
||||
"""
|
||||
proxy = select_proxy(request.url, proxies)
|
||||
scheme = urlparse(request.url).scheme
|
||||
|
||||
is_proxied_http_request = (proxy and scheme != 'https')
|
||||
using_socks_proxy = False
|
||||
if proxy:
|
||||
proxy_scheme = urlparse(proxy).scheme.lower()
|
||||
using_socks_proxy = proxy_scheme.startswith('socks')
|
||||
|
||||
url = request.path_url
|
||||
if is_proxied_http_request and not using_socks_proxy:
|
||||
url = urldefragauth(request.url)
|
||||
|
||||
return url
|
||||
|
||||
def add_headers(self, request, **kwargs):
|
||||
"""Add any headers needed by the connection. As of v2.0 this does
|
||||
nothing by default, but is left for overriding by users that subclass
|
||||
the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
||||
|
||||
This should not be called from user code, and is only exposed for use
|
||||
when subclassing the
|
||||
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
||||
|
||||
:param request: The :class:`PreparedRequest <PreparedRequest>` to add headers to.
|
||||
:param kwargs: The keyword arguments from the call to send().
|
||||
"""
|
||||
pass
|
||||
|
||||
def proxy_headers(self, proxy):
|
||||
"""Returns a dictionary of the headers to add to any request sent
|
||||
through a proxy. This works with urllib3 magic to ensure that they are
|
||||
correctly sent to the proxy, rather than in a tunnelled request if
|
||||
CONNECT is being used.
|
||||
|
||||
This should not be called from user code, and is only exposed for use
|
||||
when subclassing the
|
||||
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
|
||||
|
||||
:param proxies: The url of the proxy being used for this request.
|
||||
:rtype: dict
|
||||
"""
|
||||
headers = {}
|
||||
username, password = get_auth_from_url(proxy)
|
||||
|
||||
if username:
|
||||
headers['Proxy-Authorization'] = _basic_auth_str(username,
|
||||
password)
|
||||
|
||||
return headers
|
||||
|
||||
def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None):
|
||||
"""Sends PreparedRequest object. Returns Response object.
|
||||
|
||||
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
|
||||
:param stream: (optional) Whether to stream the request content.
|
||||
:param timeout: (optional) How long to wait for the server to send
|
||||
data before giving up, as a float, or a :ref:`(connect timeout,
|
||||
read timeout) <timeouts>` tuple.
|
||||
:type timeout: float or tuple or urllib3 Timeout object
|
||||
:param verify: (optional) Either a boolean, in which case it controls whether
|
||||
we verify the server's TLS certificate, or a string, in which case it
|
||||
must be a path to a CA bundle to use
|
||||
:param cert: (optional) Any user-provided SSL certificate to be trusted.
|
||||
:param proxies: (optional) The proxies dictionary to apply to the request.
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
conn = self.get_connection(request.url, proxies)
|
||||
|
||||
self.cert_verify(conn, request.url, verify, cert)
|
||||
url = self.request_url(request, proxies)
|
||||
self.add_headers(request)
|
||||
|
||||
chunked = not (request.body is None or 'Content-Length' in request.headers)
|
||||
|
||||
if isinstance(timeout, tuple):
|
||||
try:
|
||||
connect, read = timeout
|
||||
timeout = TimeoutSauce(connect=connect, read=read)
|
||||
except ValueError as e:
|
||||
# this may raise a string formatting error.
|
||||
err = ("Invalid timeout {0}. Pass a (connect, read) "
|
||||
"timeout tuple, or a single float to set "
|
||||
"both timeouts to the same value".format(timeout))
|
||||
raise ValueError(err)
|
||||
elif isinstance(timeout, TimeoutSauce):
|
||||
pass
|
||||
else:
|
||||
timeout = TimeoutSauce(connect=timeout, read=timeout)
|
||||
|
||||
try:
|
||||
if not chunked:
|
||||
resp = conn.urlopen(
|
||||
method=request.method,
|
||||
url=url,
|
||||
body=request.body,
|
||||
headers=request.headers,
|
||||
redirect=False,
|
||||
assert_same_host=False,
|
||||
preload_content=False,
|
||||
decode_content=False,
|
||||
retries=self.max_retries,
|
||||
timeout=timeout
|
||||
)
|
||||
|
||||
# Send the request.
|
||||
else:
|
||||
if hasattr(conn, 'proxy_pool'):
|
||||
conn = conn.proxy_pool
|
||||
|
||||
low_conn = conn._get_conn(timeout=DEFAULT_POOL_TIMEOUT)
|
||||
|
||||
try:
|
||||
low_conn.putrequest(request.method,
|
||||
url,
|
||||
skip_accept_encoding=True)
|
||||
|
||||
for header, value in request.headers.items():
|
||||
low_conn.putheader(header, value)
|
||||
|
||||
low_conn.endheaders()
|
||||
|
||||
for i in request.body:
|
||||
low_conn.send(hex(len(i))[2:].encode('utf-8'))
|
||||
low_conn.send(b'\r\n')
|
||||
low_conn.send(i)
|
||||
low_conn.send(b'\r\n')
|
||||
low_conn.send(b'0\r\n\r\n')
|
||||
|
||||
# Receive the response from the server
|
||||
try:
|
||||
# For Python 2.7+ versions, use buffering of HTTP
|
||||
# responses
|
||||
r = low_conn.getresponse(buffering=True)
|
||||
except TypeError:
|
||||
# For compatibility with Python 2.6 versions and back
|
||||
r = low_conn.getresponse()
|
||||
|
||||
resp = HTTPResponse.from_httplib(
|
||||
r,
|
||||
pool=conn,
|
||||
connection=low_conn,
|
||||
preload_content=False,
|
||||
decode_content=False
|
||||
)
|
||||
except:
|
||||
# If we hit any problems here, clean up the connection.
|
||||
# Then, reraise so that we can handle the actual exception.
|
||||
low_conn.close()
|
||||
raise
|
||||
|
||||
except (ProtocolError, socket.error) as err:
|
||||
raise ConnectionError(err, request=request)
|
||||
|
||||
except MaxRetryError as e:
|
||||
if isinstance(e.reason, ConnectTimeoutError):
|
||||
# TODO: Remove this in 3.0.0: see #2811
|
||||
if not isinstance(e.reason, NewConnectionError):
|
||||
raise ConnectTimeout(e, request=request)
|
||||
|
||||
if isinstance(e.reason, ResponseError):
|
||||
raise RetryError(e, request=request)
|
||||
|
||||
if isinstance(e.reason, _ProxyError):
|
||||
raise ProxyError(e, request=request)
|
||||
|
||||
if isinstance(e.reason, _SSLError):
|
||||
# This branch is for urllib3 v1.22 and later.
|
||||
raise SSLError(e, request=request)
|
||||
|
||||
raise ConnectionError(e, request=request)
|
||||
|
||||
except ClosedPoolError as e:
|
||||
raise ConnectionError(e, request=request)
|
||||
|
||||
except _ProxyError as e:
|
||||
raise ProxyError(e)
|
||||
|
||||
except (_SSLError, _HTTPError) as e:
|
||||
if isinstance(e, _SSLError):
|
||||
# This branch is for urllib3 versions earlier than v1.22
|
||||
raise SSLError(e, request=request)
|
||||
elif isinstance(e, ReadTimeoutError):
|
||||
raise ReadTimeout(e, request=request)
|
||||
else:
|
||||
raise
|
||||
|
||||
return self.build_response(request, resp)
|
||||
152
requests/api.py
Normal file
152
requests/api.py
Normal file
@@ -0,0 +1,152 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.api
|
||||
~~~~~~~~~~~~
|
||||
|
||||
This module implements the Requests API.
|
||||
|
||||
:copyright: (c) 2012 by Kenneth Reitz.
|
||||
:license: Apache2, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
from . import sessions
|
||||
|
||||
|
||||
def request(method, url, **kwargs):
|
||||
"""Constructs and sends a :class:`Request <Request>`.
|
||||
|
||||
:param method: method for the new :class:`Request` object.
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.
|
||||
:param data: (optional) Dictionary or list of tuples ``[(key, value)]`` (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.
|
||||
:param json: (optional) json data to send in the body of the :class:`Request`.
|
||||
:param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
|
||||
:param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`.
|
||||
:param files: (optional) Dictionary of ``'name': file-like-objects`` (or ``{'name': file-tuple}``) for multipart encoding upload.
|
||||
``file-tuple`` can be a 2-tuple ``('filename', fileobj)``, 3-tuple ``('filename', fileobj, 'content_type')``
|
||||
or a 4-tuple ``('filename', fileobj, 'content_type', custom_headers)``, where ``'content-type'`` is a string
|
||||
defining the content type of the given file and ``custom_headers`` a dict-like object containing additional headers
|
||||
to add for the file.
|
||||
:param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth.
|
||||
:param timeout: (optional) How many seconds to wait for the server to send data
|
||||
before giving up, as a float, or a :ref:`(connect timeout, read
|
||||
timeout) <timeouts>` tuple.
|
||||
:type timeout: float or tuple
|
||||
:param allow_redirects: (optional) Boolean. Enable/disable GET/OPTIONS/POST/PUT/PATCH/DELETE/HEAD redirection. Defaults to ``True``.
|
||||
:type allow_redirects: bool
|
||||
:param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
|
||||
:param verify: (optional) Either a boolean, in which case it controls whether we verify
|
||||
the server's TLS certificate, or a string, in which case it must be a path
|
||||
to a CA bundle to use. Defaults to ``True``.
|
||||
:param stream: (optional) if ``False``, the response content will be immediately downloaded.
|
||||
:param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
|
||||
:return: :class:`Response <Response>` object
|
||||
:rtype: requests.Response
|
||||
|
||||
Usage::
|
||||
|
||||
>>> import requests
|
||||
>>> req = requests.request('GET', 'http://httpbin.org/get')
|
||||
<Response [200]>
|
||||
"""
|
||||
|
||||
# By using the 'with' statement we are sure the session is closed, thus we
|
||||
# avoid leaving sockets open which can trigger a ResourceWarning in some
|
||||
# cases, and look like a memory leak in others.
|
||||
with sessions.Session() as session:
|
||||
return session.request(method=method, url=url, **kwargs)
|
||||
|
||||
|
||||
def get(url, params=None, **kwargs):
|
||||
r"""Sends a GET request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:return: :class:`Response <Response>` object
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
kwargs.setdefault('allow_redirects', True)
|
||||
return request('get', url, params=params, **kwargs)
|
||||
|
||||
|
||||
def options(url, **kwargs):
|
||||
r"""Sends an OPTIONS request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:return: :class:`Response <Response>` object
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
kwargs.setdefault('allow_redirects', True)
|
||||
return request('options', url, **kwargs)
|
||||
|
||||
|
||||
def head(url, **kwargs):
|
||||
r"""Sends a HEAD request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:return: :class:`Response <Response>` object
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
kwargs.setdefault('allow_redirects', False)
|
||||
return request('head', url, **kwargs)
|
||||
|
||||
|
||||
def post(url, data=None, json=None, **kwargs):
|
||||
r"""Sends a POST request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.
|
||||
:param json: (optional) json data to send in the body of the :class:`Request`.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:return: :class:`Response <Response>` object
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
return request('post', url, data=data, json=json, **kwargs)
|
||||
|
||||
|
||||
def put(url, data=None, **kwargs):
|
||||
r"""Sends a PUT request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.
|
||||
:param json: (optional) json data to send in the body of the :class:`Request`.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:return: :class:`Response <Response>` object
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
return request('put', url, data=data, **kwargs)
|
||||
|
||||
|
||||
def patch(url, data=None, **kwargs):
|
||||
r"""Sends a PATCH request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param data: (optional) Dictionary (will be form-encoded), bytes, or file-like object to send in the body of the :class:`Request`.
|
||||
:param json: (optional) json data to send in the body of the :class:`Request`.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:return: :class:`Response <Response>` object
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
return request('patch', url, data=data, **kwargs)
|
||||
|
||||
|
||||
def delete(url, **kwargs):
|
||||
r"""Sends a DELETE request.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:return: :class:`Response <Response>` object
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
return request('delete', url, **kwargs)
|
||||
293
requests/auth.py
Normal file
293
requests/auth.py
Normal file
@@ -0,0 +1,293 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.auth
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
This module contains the authentication handlers for Requests.
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import hashlib
|
||||
import threading
|
||||
import warnings
|
||||
|
||||
from base64 import b64encode
|
||||
|
||||
from .compat import urlparse, str, basestring
|
||||
from .cookies import extract_cookies_to_jar
|
||||
from ._internal_utils import to_native_string
|
||||
from .utils import parse_dict_header
|
||||
|
||||
CONTENT_TYPE_FORM_URLENCODED = 'application/x-www-form-urlencoded'
|
||||
CONTENT_TYPE_MULTI_PART = 'multipart/form-data'
|
||||
|
||||
|
||||
def _basic_auth_str(username, password):
|
||||
"""Returns a Basic Auth string."""
|
||||
|
||||
# "I want us to put a big-ol' comment on top of it that
|
||||
# says that this behaviour is dumb but we need to preserve
|
||||
# it because people are relying on it."
|
||||
# - Lukasa
|
||||
#
|
||||
# These are here solely to maintain backwards compatibility
|
||||
# for things like ints. This will be removed in 3.0.0.
|
||||
if not isinstance(username, basestring):
|
||||
warnings.warn(
|
||||
"Non-string usernames will no longer be supported in Requests "
|
||||
"3.0.0. Please convert the object you've passed in ({0!r}) to "
|
||||
"a string or bytes object in the near future to avoid "
|
||||
"problems.".format(username),
|
||||
category=DeprecationWarning,
|
||||
)
|
||||
username = str(username)
|
||||
|
||||
if not isinstance(password, basestring):
|
||||
warnings.warn(
|
||||
"Non-string passwords will no longer be supported in Requests "
|
||||
"3.0.0. Please convert the object you've passed in ({0!r}) to "
|
||||
"a string or bytes object in the near future to avoid "
|
||||
"problems.".format(password),
|
||||
category=DeprecationWarning,
|
||||
)
|
||||
password = str(password)
|
||||
# -- End Removal --
|
||||
|
||||
if isinstance(username, str):
|
||||
username = username.encode('latin1')
|
||||
|
||||
if isinstance(password, str):
|
||||
password = password.encode('latin1')
|
||||
|
||||
authstr = 'Basic ' + to_native_string(
|
||||
b64encode(b':'.join((username, password))).strip()
|
||||
)
|
||||
|
||||
return authstr
|
||||
|
||||
|
||||
class AuthBase(object):
|
||||
"""Base class that all auth implementations derive from"""
|
||||
|
||||
def __call__(self, r):
|
||||
raise NotImplementedError('Auth hooks must be callable.')
|
||||
|
||||
|
||||
class HTTPBasicAuth(AuthBase):
|
||||
"""Attaches HTTP Basic Authentication to the given Request object."""
|
||||
|
||||
def __init__(self, username, password):
|
||||
self.username = username
|
||||
self.password = password
|
||||
|
||||
def __eq__(self, other):
|
||||
return all([
|
||||
self.username == getattr(other, 'username', None),
|
||||
self.password == getattr(other, 'password', None)
|
||||
])
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __call__(self, r):
|
||||
r.headers['Authorization'] = _basic_auth_str(self.username, self.password)
|
||||
return r
|
||||
|
||||
|
||||
class HTTPProxyAuth(HTTPBasicAuth):
|
||||
"""Attaches HTTP Proxy Authentication to a given Request object."""
|
||||
|
||||
def __call__(self, r):
|
||||
r.headers['Proxy-Authorization'] = _basic_auth_str(self.username, self.password)
|
||||
return r
|
||||
|
||||
|
||||
class HTTPDigestAuth(AuthBase):
|
||||
"""Attaches HTTP Digest Authentication to the given Request object."""
|
||||
|
||||
def __init__(self, username, password):
|
||||
self.username = username
|
||||
self.password = password
|
||||
# Keep state in per-thread local storage
|
||||
self._thread_local = threading.local()
|
||||
|
||||
def init_per_thread_state(self):
|
||||
# Ensure state is initialized just once per-thread
|
||||
if not hasattr(self._thread_local, 'init'):
|
||||
self._thread_local.init = True
|
||||
self._thread_local.last_nonce = ''
|
||||
self._thread_local.nonce_count = 0
|
||||
self._thread_local.chal = {}
|
||||
self._thread_local.pos = None
|
||||
self._thread_local.num_401_calls = None
|
||||
|
||||
def build_digest_header(self, method, url):
|
||||
"""
|
||||
:rtype: str
|
||||
"""
|
||||
|
||||
realm = self._thread_local.chal['realm']
|
||||
nonce = self._thread_local.chal['nonce']
|
||||
qop = self._thread_local.chal.get('qop')
|
||||
algorithm = self._thread_local.chal.get('algorithm')
|
||||
opaque = self._thread_local.chal.get('opaque')
|
||||
hash_utf8 = None
|
||||
|
||||
if algorithm is None:
|
||||
_algorithm = 'MD5'
|
||||
else:
|
||||
_algorithm = algorithm.upper()
|
||||
# lambdas assume digest modules are imported at the top level
|
||||
if _algorithm == 'MD5' or _algorithm == 'MD5-SESS':
|
||||
def md5_utf8(x):
|
||||
if isinstance(x, str):
|
||||
x = x.encode('utf-8')
|
||||
return hashlib.md5(x).hexdigest()
|
||||
hash_utf8 = md5_utf8
|
||||
elif _algorithm == 'SHA':
|
||||
def sha_utf8(x):
|
||||
if isinstance(x, str):
|
||||
x = x.encode('utf-8')
|
||||
return hashlib.sha1(x).hexdigest()
|
||||
hash_utf8 = sha_utf8
|
||||
|
||||
KD = lambda s, d: hash_utf8("%s:%s" % (s, d))
|
||||
|
||||
if hash_utf8 is None:
|
||||
return None
|
||||
|
||||
# XXX not implemented yet
|
||||
entdig = None
|
||||
p_parsed = urlparse(url)
|
||||
#: path is request-uri defined in RFC 2616 which should not be empty
|
||||
path = p_parsed.path or "/"
|
||||
if p_parsed.query:
|
||||
path += '?' + p_parsed.query
|
||||
|
||||
A1 = '%s:%s:%s' % (self.username, realm, self.password)
|
||||
A2 = '%s:%s' % (method, path)
|
||||
|
||||
HA1 = hash_utf8(A1)
|
||||
HA2 = hash_utf8(A2)
|
||||
|
||||
if nonce == self._thread_local.last_nonce:
|
||||
self._thread_local.nonce_count += 1
|
||||
else:
|
||||
self._thread_local.nonce_count = 1
|
||||
ncvalue = '%08x' % self._thread_local.nonce_count
|
||||
s = str(self._thread_local.nonce_count).encode('utf-8')
|
||||
s += nonce.encode('utf-8')
|
||||
s += time.ctime().encode('utf-8')
|
||||
s += os.urandom(8)
|
||||
|
||||
cnonce = (hashlib.sha1(s).hexdigest()[:16])
|
||||
if _algorithm == 'MD5-SESS':
|
||||
HA1 = hash_utf8('%s:%s:%s' % (HA1, nonce, cnonce))
|
||||
|
||||
if not qop:
|
||||
respdig = KD(HA1, "%s:%s" % (nonce, HA2))
|
||||
elif qop == 'auth' or 'auth' in qop.split(','):
|
||||
noncebit = "%s:%s:%s:%s:%s" % (
|
||||
nonce, ncvalue, cnonce, 'auth', HA2
|
||||
)
|
||||
respdig = KD(HA1, noncebit)
|
||||
else:
|
||||
# XXX handle auth-int.
|
||||
return None
|
||||
|
||||
self._thread_local.last_nonce = nonce
|
||||
|
||||
# XXX should the partial digests be encoded too?
|
||||
base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \
|
||||
'response="%s"' % (self.username, realm, nonce, path, respdig)
|
||||
if opaque:
|
||||
base += ', opaque="%s"' % opaque
|
||||
if algorithm:
|
||||
base += ', algorithm="%s"' % algorithm
|
||||
if entdig:
|
||||
base += ', digest="%s"' % entdig
|
||||
if qop:
|
||||
base += ', qop="auth", nc=%s, cnonce="%s"' % (ncvalue, cnonce)
|
||||
|
||||
return 'Digest %s' % (base)
|
||||
|
||||
def handle_redirect(self, r, **kwargs):
|
||||
"""Reset num_401_calls counter on redirects."""
|
||||
if r.is_redirect:
|
||||
self._thread_local.num_401_calls = 1
|
||||
|
||||
def handle_401(self, r, **kwargs):
|
||||
"""
|
||||
Takes the given response and tries digest-auth, if needed.
|
||||
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
# If response is not 4xx, do not auth
|
||||
# See https://github.com/requests/requests/issues/3772
|
||||
if not 400 <= r.status_code < 500:
|
||||
self._thread_local.num_401_calls = 1
|
||||
return r
|
||||
|
||||
if self._thread_local.pos is not None:
|
||||
# Rewind the file position indicator of the body to where
|
||||
# it was to resend the request.
|
||||
r.request.body.seek(self._thread_local.pos)
|
||||
s_auth = r.headers.get('www-authenticate', '')
|
||||
|
||||
if 'digest' in s_auth.lower() and self._thread_local.num_401_calls < 2:
|
||||
|
||||
self._thread_local.num_401_calls += 1
|
||||
pat = re.compile(r'digest ', flags=re.IGNORECASE)
|
||||
self._thread_local.chal = parse_dict_header(pat.sub('', s_auth, count=1))
|
||||
|
||||
# Consume content and release the original connection
|
||||
# to allow our new request to reuse the same one.
|
||||
r.content
|
||||
r.close()
|
||||
prep = r.request.copy()
|
||||
extract_cookies_to_jar(prep._cookies, r.request, r.raw)
|
||||
prep.prepare_cookies(prep._cookies)
|
||||
|
||||
prep.headers['Authorization'] = self.build_digest_header(
|
||||
prep.method, prep.url)
|
||||
_r = r.connection.send(prep, **kwargs)
|
||||
_r.history.append(r)
|
||||
_r.request = prep
|
||||
|
||||
return _r
|
||||
|
||||
self._thread_local.num_401_calls = 1
|
||||
return r
|
||||
|
||||
def __call__(self, r):
|
||||
# Initialize per-thread state, if needed
|
||||
self.init_per_thread_state()
|
||||
# If we have a saved nonce, skip the 401
|
||||
if self._thread_local.last_nonce:
|
||||
r.headers['Authorization'] = self.build_digest_header(r.method, r.url)
|
||||
try:
|
||||
self._thread_local.pos = r.body.tell()
|
||||
except AttributeError:
|
||||
# In the case of HTTPDigestAuth being reused and the body of
|
||||
# the previous request was a file-like object, pos has the
|
||||
# file position of the previous body. Ensure it's set to
|
||||
# None.
|
||||
self._thread_local.pos = None
|
||||
r.register_hook('response', self.handle_401)
|
||||
r.register_hook('response', self.handle_redirect)
|
||||
self._thread_local.num_401_calls = 1
|
||||
|
||||
return r
|
||||
|
||||
def __eq__(self, other):
|
||||
return all([
|
||||
self.username == getattr(other, 'username', None),
|
||||
self.password == getattr(other, 'password', None)
|
||||
])
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
18
requests/certs.py
Normal file
18
requests/certs.py
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.certs
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
This module returns the preferred default CA certificate bundle. There is
|
||||
only one — the one from the certifi package.
|
||||
|
||||
If you are packaging Requests, e.g., for a Linux distribution or a managed
|
||||
environment, you can change the definition of where() to return a separately
|
||||
packaged CA bundle.
|
||||
"""
|
||||
from certifi import where
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(where())
|
||||
69
requests/compat.py
Normal file
69
requests/compat.py
Normal file
@@ -0,0 +1,69 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.compat
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
This module handles import compatibility issues between Python 2 and
|
||||
Python 3.
|
||||
"""
|
||||
|
||||
import chardet
|
||||
|
||||
import sys
|
||||
|
||||
# -------
|
||||
# Pythons
|
||||
# -------
|
||||
|
||||
# Syntax sugar.
|
||||
_ver = sys.version_info
|
||||
|
||||
#: Python 2.x?
|
||||
is_py2 = (_ver[0] == 2)
|
||||
|
||||
#: Python 3.x?
|
||||
is_py3 = (_ver[0] == 3)
|
||||
|
||||
try:
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
# ---------
|
||||
# Specifics
|
||||
# ---------
|
||||
|
||||
if is_py2:
|
||||
from urllib import (
|
||||
quote, unquote, quote_plus, unquote_plus, urlencode, getproxies,
|
||||
proxy_bypass, proxy_bypass_environment, getproxies_environment)
|
||||
from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag
|
||||
from urllib2 import parse_http_list
|
||||
import cookielib
|
||||
from Cookie import Morsel
|
||||
from StringIO import StringIO
|
||||
|
||||
from urllib3.packages.ordered_dict import OrderedDict
|
||||
|
||||
builtin_str = str
|
||||
bytes = str
|
||||
str = unicode
|
||||
basestring = basestring
|
||||
numeric_types = (int, long, float)
|
||||
integer_types = (int, long)
|
||||
|
||||
elif is_py3:
|
||||
from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag
|
||||
from urllib.request import parse_http_list, getproxies, proxy_bypass, proxy_bypass_environment, getproxies_environment
|
||||
from http import cookiejar as cookielib
|
||||
from http.cookies import Morsel
|
||||
from io import StringIO
|
||||
from collections import OrderedDict
|
||||
|
||||
builtin_str = str
|
||||
str = str
|
||||
bytes = bytes
|
||||
basestring = (str, bytes)
|
||||
numeric_types = (int, float)
|
||||
integer_types = (int,)
|
||||
542
requests/cookies.py
Normal file
542
requests/cookies.py
Normal file
@@ -0,0 +1,542 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.cookies
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
Compatibility code to be able to use `cookielib.CookieJar` with requests.
|
||||
|
||||
requests.utils imports from here, so be careful with imports.
|
||||
"""
|
||||
|
||||
import copy
|
||||
import time
|
||||
import calendar
|
||||
import collections
|
||||
|
||||
from ._internal_utils import to_native_string
|
||||
from .compat import cookielib, urlparse, urlunparse, Morsel
|
||||
|
||||
try:
|
||||
import threading
|
||||
except ImportError:
|
||||
import dummy_threading as threading
|
||||
|
||||
|
||||
class MockRequest(object):
|
||||
"""Wraps a `requests.Request` to mimic a `urllib2.Request`.
|
||||
|
||||
The code in `cookielib.CookieJar` expects this interface in order to correctly
|
||||
manage cookie policies, i.e., determine whether a cookie can be set, given the
|
||||
domains of the request and the cookie.
|
||||
|
||||
The original request object is read-only. The client is responsible for collecting
|
||||
the new headers via `get_new_headers()` and interpreting them appropriately. You
|
||||
probably want `get_cookie_header`, defined below.
|
||||
"""
|
||||
|
||||
def __init__(self, request):
|
||||
self._r = request
|
||||
self._new_headers = {}
|
||||
self.type = urlparse(self._r.url).scheme
|
||||
|
||||
def get_type(self):
|
||||
return self.type
|
||||
|
||||
def get_host(self):
|
||||
return urlparse(self._r.url).netloc
|
||||
|
||||
def get_origin_req_host(self):
|
||||
return self.get_host()
|
||||
|
||||
def get_full_url(self):
|
||||
# Only return the response's URL if the user hadn't set the Host
|
||||
# header
|
||||
if not self._r.headers.get('Host'):
|
||||
return self._r.url
|
||||
# If they did set it, retrieve it and reconstruct the expected domain
|
||||
host = to_native_string(self._r.headers['Host'], encoding='utf-8')
|
||||
parsed = urlparse(self._r.url)
|
||||
# Reconstruct the URL as we expect it
|
||||
return urlunparse([
|
||||
parsed.scheme, host, parsed.path, parsed.params, parsed.query,
|
||||
parsed.fragment
|
||||
])
|
||||
|
||||
def is_unverifiable(self):
|
||||
return True
|
||||
|
||||
def has_header(self, name):
|
||||
return name in self._r.headers or name in self._new_headers
|
||||
|
||||
def get_header(self, name, default=None):
|
||||
return self._r.headers.get(name, self._new_headers.get(name, default))
|
||||
|
||||
def add_header(self, key, val):
|
||||
"""cookielib has no legitimate use for this method; add it back if you find one."""
|
||||
raise NotImplementedError("Cookie headers should be added with add_unredirected_header()")
|
||||
|
||||
def add_unredirected_header(self, name, value):
|
||||
self._new_headers[name] = value
|
||||
|
||||
def get_new_headers(self):
|
||||
return self._new_headers
|
||||
|
||||
@property
|
||||
def unverifiable(self):
|
||||
return self.is_unverifiable()
|
||||
|
||||
@property
|
||||
def origin_req_host(self):
|
||||
return self.get_origin_req_host()
|
||||
|
||||
@property
|
||||
def host(self):
|
||||
return self.get_host()
|
||||
|
||||
|
||||
class MockResponse(object):
|
||||
"""Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.
|
||||
|
||||
...what? Basically, expose the parsed HTTP headers from the server response
|
||||
the way `cookielib` expects to see them.
|
||||
"""
|
||||
|
||||
def __init__(self, headers):
|
||||
"""Make a MockResponse for `cookielib` to read.
|
||||
|
||||
:param headers: a httplib.HTTPMessage or analogous carrying the headers
|
||||
"""
|
||||
self._headers = headers
|
||||
|
||||
def info(self):
|
||||
return self._headers
|
||||
|
||||
def getheaders(self, name):
|
||||
self._headers.getheaders(name)
|
||||
|
||||
|
||||
def extract_cookies_to_jar(jar, request, response):
|
||||
"""Extract the cookies from the response into a CookieJar.
|
||||
|
||||
:param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar)
|
||||
:param request: our own requests.Request object
|
||||
:param response: urllib3.HTTPResponse object
|
||||
"""
|
||||
if not (hasattr(response, '_original_response') and
|
||||
response._original_response):
|
||||
return
|
||||
# the _original_response field is the wrapped httplib.HTTPResponse object,
|
||||
req = MockRequest(request)
|
||||
# pull out the HTTPMessage with the headers and put it in the mock:
|
||||
res = MockResponse(response._original_response.msg)
|
||||
jar.extract_cookies(res, req)
|
||||
|
||||
|
||||
def get_cookie_header(jar, request):
|
||||
"""
|
||||
Produce an appropriate Cookie header string to be sent with `request`, or None.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
r = MockRequest(request)
|
||||
jar.add_cookie_header(r)
|
||||
return r.get_new_headers().get('Cookie')
|
||||
|
||||
|
||||
def remove_cookie_by_name(cookiejar, name, domain=None, path=None):
|
||||
"""Unsets a cookie by name, by default over all domains and paths.
|
||||
|
||||
Wraps CookieJar.clear(), is O(n).
|
||||
"""
|
||||
clearables = []
|
||||
for cookie in cookiejar:
|
||||
if cookie.name != name:
|
||||
continue
|
||||
if domain is not None and domain != cookie.domain:
|
||||
continue
|
||||
if path is not None and path != cookie.path:
|
||||
continue
|
||||
clearables.append((cookie.domain, cookie.path, cookie.name))
|
||||
|
||||
for domain, path, name in clearables:
|
||||
cookiejar.clear(domain, path, name)
|
||||
|
||||
|
||||
class CookieConflictError(RuntimeError):
|
||||
"""There are two cookies that meet the criteria specified in the cookie jar.
|
||||
Use .get and .set and include domain and path args in order to be more specific.
|
||||
"""
|
||||
|
||||
|
||||
class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
|
||||
"""Compatibility class; is a cookielib.CookieJar, but exposes a dict
|
||||
interface.
|
||||
|
||||
This is the CookieJar we create by default for requests and sessions that
|
||||
don't specify one, since some clients may expect response.cookies and
|
||||
session.cookies to support dict operations.
|
||||
|
||||
Requests does not use the dict interface internally; it's just for
|
||||
compatibility with external client code. All requests code should work
|
||||
out of the box with externally provided instances of ``CookieJar``, e.g.
|
||||
``LWPCookieJar`` and ``FileCookieJar``.
|
||||
|
||||
Unlike a regular CookieJar, this class is pickleable.
|
||||
|
||||
.. warning:: dictionary operations that are normally O(1) may be O(n).
|
||||
"""
|
||||
|
||||
def get(self, name, default=None, domain=None, path=None):
|
||||
"""Dict-like get() that also supports optional domain and path args in
|
||||
order to resolve naming collisions from using one cookie jar over
|
||||
multiple domains.
|
||||
|
||||
.. warning:: operation is O(n), not O(1).
|
||||
"""
|
||||
try:
|
||||
return self._find_no_duplicates(name, domain, path)
|
||||
except KeyError:
|
||||
return default
|
||||
|
||||
def set(self, name, value, **kwargs):
|
||||
"""Dict-like set() that also supports optional domain and path args in
|
||||
order to resolve naming collisions from using one cookie jar over
|
||||
multiple domains.
|
||||
"""
|
||||
# support client code that unsets cookies by assignment of a None value:
|
||||
if value is None:
|
||||
remove_cookie_by_name(self, name, domain=kwargs.get('domain'), path=kwargs.get('path'))
|
||||
return
|
||||
|
||||
if isinstance(value, Morsel):
|
||||
c = morsel_to_cookie(value)
|
||||
else:
|
||||
c = create_cookie(name, value, **kwargs)
|
||||
self.set_cookie(c)
|
||||
return c
|
||||
|
||||
def iterkeys(self):
|
||||
"""Dict-like iterkeys() that returns an iterator of names of cookies
|
||||
from the jar.
|
||||
|
||||
.. seealso:: itervalues() and iteritems().
|
||||
"""
|
||||
for cookie in iter(self):
|
||||
yield cookie.name
|
||||
|
||||
def keys(self):
|
||||
"""Dict-like keys() that returns a list of names of cookies from the
|
||||
jar.
|
||||
|
||||
.. seealso:: values() and items().
|
||||
"""
|
||||
return list(self.iterkeys())
|
||||
|
||||
def itervalues(self):
|
||||
"""Dict-like itervalues() that returns an iterator of values of cookies
|
||||
from the jar.
|
||||
|
||||
.. seealso:: iterkeys() and iteritems().
|
||||
"""
|
||||
for cookie in iter(self):
|
||||
yield cookie.value
|
||||
|
||||
def values(self):
|
||||
"""Dict-like values() that returns a list of values of cookies from the
|
||||
jar.
|
||||
|
||||
.. seealso:: keys() and items().
|
||||
"""
|
||||
return list(self.itervalues())
|
||||
|
||||
def iteritems(self):
|
||||
"""Dict-like iteritems() that returns an iterator of name-value tuples
|
||||
from the jar.
|
||||
|
||||
.. seealso:: iterkeys() and itervalues().
|
||||
"""
|
||||
for cookie in iter(self):
|
||||
yield cookie.name, cookie.value
|
||||
|
||||
def items(self):
|
||||
"""Dict-like items() that returns a list of name-value tuples from the
|
||||
jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a
|
||||
vanilla python dict of key value pairs.
|
||||
|
||||
.. seealso:: keys() and values().
|
||||
"""
|
||||
return list(self.iteritems())
|
||||
|
||||
def list_domains(self):
|
||||
"""Utility method to list all the domains in the jar."""
|
||||
domains = []
|
||||
for cookie in iter(self):
|
||||
if cookie.domain not in domains:
|
||||
domains.append(cookie.domain)
|
||||
return domains
|
||||
|
||||
def list_paths(self):
|
||||
"""Utility method to list all the paths in the jar."""
|
||||
paths = []
|
||||
for cookie in iter(self):
|
||||
if cookie.path not in paths:
|
||||
paths.append(cookie.path)
|
||||
return paths
|
||||
|
||||
def multiple_domains(self):
|
||||
"""Returns True if there are multiple domains in the jar.
|
||||
Returns False otherwise.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
domains = []
|
||||
for cookie in iter(self):
|
||||
if cookie.domain is not None and cookie.domain in domains:
|
||||
return True
|
||||
domains.append(cookie.domain)
|
||||
return False # there is only one domain in jar
|
||||
|
||||
def get_dict(self, domain=None, path=None):
|
||||
"""Takes as an argument an optional domain and path and returns a plain
|
||||
old Python dict of name-value pairs of cookies that meet the
|
||||
requirements.
|
||||
|
||||
:rtype: dict
|
||||
"""
|
||||
dictionary = {}
|
||||
for cookie in iter(self):
|
||||
if (
|
||||
(domain is None or cookie.domain == domain) and
|
||||
(path is None or cookie.path == path)
|
||||
):
|
||||
dictionary[cookie.name] = cookie.value
|
||||
return dictionary
|
||||
|
||||
def __contains__(self, name):
|
||||
try:
|
||||
return super(RequestsCookieJar, self).__contains__(name)
|
||||
except CookieConflictError:
|
||||
return True
|
||||
|
||||
def __getitem__(self, name):
|
||||
"""Dict-like __getitem__() for compatibility with client code. Throws
|
||||
exception if there are more than one cookie with name. In that case,
|
||||
use the more explicit get() method instead.
|
||||
|
||||
.. warning:: operation is O(n), not O(1).
|
||||
"""
|
||||
return self._find_no_duplicates(name)
|
||||
|
||||
def __setitem__(self, name, value):
|
||||
"""Dict-like __setitem__ for compatibility with client code. Throws
|
||||
exception if there is already a cookie of that name in the jar. In that
|
||||
case, use the more explicit set() method instead.
|
||||
"""
|
||||
self.set(name, value)
|
||||
|
||||
def __delitem__(self, name):
|
||||
"""Deletes a cookie given a name. Wraps ``cookielib.CookieJar``'s
|
||||
``remove_cookie_by_name()``.
|
||||
"""
|
||||
remove_cookie_by_name(self, name)
|
||||
|
||||
def set_cookie(self, cookie, *args, **kwargs):
|
||||
if hasattr(cookie.value, 'startswith') and cookie.value.startswith('"') and cookie.value.endswith('"'):
|
||||
cookie.value = cookie.value.replace('\\"', '')
|
||||
return super(RequestsCookieJar, self).set_cookie(cookie, *args, **kwargs)
|
||||
|
||||
def update(self, other):
|
||||
"""Updates this jar with cookies from another CookieJar or dict-like"""
|
||||
if isinstance(other, cookielib.CookieJar):
|
||||
for cookie in other:
|
||||
self.set_cookie(copy.copy(cookie))
|
||||
else:
|
||||
super(RequestsCookieJar, self).update(other)
|
||||
|
||||
def _find(self, name, domain=None, path=None):
|
||||
"""Requests uses this method internally to get cookie values.
|
||||
|
||||
If there are conflicting cookies, _find arbitrarily chooses one.
|
||||
See _find_no_duplicates if you want an exception thrown if there are
|
||||
conflicting cookies.
|
||||
|
||||
:param name: a string containing name of cookie
|
||||
:param domain: (optional) string containing domain of cookie
|
||||
:param path: (optional) string containing path of cookie
|
||||
:return: cookie.value
|
||||
"""
|
||||
for cookie in iter(self):
|
||||
if cookie.name == name:
|
||||
if domain is None or cookie.domain == domain:
|
||||
if path is None or cookie.path == path:
|
||||
return cookie.value
|
||||
|
||||
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
|
||||
|
||||
def _find_no_duplicates(self, name, domain=None, path=None):
|
||||
"""Both ``__get_item__`` and ``get`` call this function: it's never
|
||||
used elsewhere in Requests.
|
||||
|
||||
:param name: a string containing name of cookie
|
||||
:param domain: (optional) string containing domain of cookie
|
||||
:param path: (optional) string containing path of cookie
|
||||
:raises KeyError: if cookie is not found
|
||||
:raises CookieConflictError: if there are multiple cookies
|
||||
that match name and optionally domain and path
|
||||
:return: cookie.value
|
||||
"""
|
||||
toReturn = None
|
||||
for cookie in iter(self):
|
||||
if cookie.name == name:
|
||||
if domain is None or cookie.domain == domain:
|
||||
if path is None or cookie.path == path:
|
||||
if toReturn is not None: # if there are multiple cookies that meet passed in criteria
|
||||
raise CookieConflictError('There are multiple cookies with name, %r' % (name))
|
||||
toReturn = cookie.value # we will eventually return this as long as no cookie conflict
|
||||
|
||||
if toReturn:
|
||||
return toReturn
|
||||
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
|
||||
|
||||
def __getstate__(self):
|
||||
"""Unlike a normal CookieJar, this class is pickleable."""
|
||||
state = self.__dict__.copy()
|
||||
# remove the unpickleable RLock object
|
||||
state.pop('_cookies_lock')
|
||||
return state
|
||||
|
||||
def __setstate__(self, state):
|
||||
"""Unlike a normal CookieJar, this class is pickleable."""
|
||||
self.__dict__.update(state)
|
||||
if '_cookies_lock' not in self.__dict__:
|
||||
self._cookies_lock = threading.RLock()
|
||||
|
||||
def copy(self):
|
||||
"""Return a copy of this RequestsCookieJar."""
|
||||
new_cj = RequestsCookieJar()
|
||||
new_cj.update(self)
|
||||
return new_cj
|
||||
|
||||
|
||||
def _copy_cookie_jar(jar):
|
||||
if jar is None:
|
||||
return None
|
||||
|
||||
if hasattr(jar, 'copy'):
|
||||
# We're dealing with an instance of RequestsCookieJar
|
||||
return jar.copy()
|
||||
# We're dealing with a generic CookieJar instance
|
||||
new_jar = copy.copy(jar)
|
||||
new_jar.clear()
|
||||
for cookie in jar:
|
||||
new_jar.set_cookie(copy.copy(cookie))
|
||||
return new_jar
|
||||
|
||||
|
||||
def create_cookie(name, value, **kwargs):
|
||||
"""Make a cookie from underspecified parameters.
|
||||
|
||||
By default, the pair of `name` and `value` will be set for the domain ''
|
||||
and sent on every request (this is sometimes called a "supercookie").
|
||||
"""
|
||||
result = dict(
|
||||
version=0,
|
||||
name=name,
|
||||
value=value,
|
||||
port=None,
|
||||
domain='',
|
||||
path='/',
|
||||
secure=False,
|
||||
expires=None,
|
||||
discard=True,
|
||||
comment=None,
|
||||
comment_url=None,
|
||||
rest={'HttpOnly': None},
|
||||
rfc2109=False,)
|
||||
|
||||
badargs = set(kwargs) - set(result)
|
||||
if badargs:
|
||||
err = 'create_cookie() got unexpected keyword arguments: %s'
|
||||
raise TypeError(err % list(badargs))
|
||||
|
||||
result.update(kwargs)
|
||||
result['port_specified'] = bool(result['port'])
|
||||
result['domain_specified'] = bool(result['domain'])
|
||||
result['domain_initial_dot'] = result['domain'].startswith('.')
|
||||
result['path_specified'] = bool(result['path'])
|
||||
|
||||
return cookielib.Cookie(**result)
|
||||
|
||||
|
||||
def morsel_to_cookie(morsel):
|
||||
"""Convert a Morsel object into a Cookie containing the one k/v pair."""
|
||||
|
||||
expires = None
|
||||
if morsel['max-age']:
|
||||
try:
|
||||
expires = int(time.time() + int(morsel['max-age']))
|
||||
except ValueError:
|
||||
raise TypeError('max-age: %s must be integer' % morsel['max-age'])
|
||||
elif morsel['expires']:
|
||||
time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
|
||||
expires = calendar.timegm(
|
||||
time.strptime(morsel['expires'], time_template)
|
||||
)
|
||||
return create_cookie(
|
||||
comment=morsel['comment'],
|
||||
comment_url=bool(morsel['comment']),
|
||||
discard=False,
|
||||
domain=morsel['domain'],
|
||||
expires=expires,
|
||||
name=morsel.key,
|
||||
path=morsel['path'],
|
||||
port=None,
|
||||
rest={'HttpOnly': morsel['httponly']},
|
||||
rfc2109=False,
|
||||
secure=bool(morsel['secure']),
|
||||
value=morsel.value,
|
||||
version=morsel['version'] or 0,
|
||||
)
|
||||
|
||||
|
||||
def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True):
|
||||
"""Returns a CookieJar from a key/value dictionary.
|
||||
|
||||
:param cookie_dict: Dict of key/values to insert into CookieJar.
|
||||
:param cookiejar: (optional) A cookiejar to add the cookies to.
|
||||
:param overwrite: (optional) If False, will not replace cookies
|
||||
already in the jar with new ones.
|
||||
"""
|
||||
if cookiejar is None:
|
||||
cookiejar = RequestsCookieJar()
|
||||
|
||||
if cookie_dict is not None:
|
||||
names_from_jar = [cookie.name for cookie in cookiejar]
|
||||
for name in cookie_dict:
|
||||
if overwrite or (name not in names_from_jar):
|
||||
cookiejar.set_cookie(create_cookie(name, cookie_dict[name]))
|
||||
|
||||
return cookiejar
|
||||
|
||||
|
||||
def merge_cookies(cookiejar, cookies):
|
||||
"""Add cookies to cookiejar and returns a merged CookieJar.
|
||||
|
||||
:param cookiejar: CookieJar object to add the cookies to.
|
||||
:param cookies: Dictionary or CookieJar object to be added.
|
||||
"""
|
||||
if not isinstance(cookiejar, cookielib.CookieJar):
|
||||
raise ValueError('You can only merge into CookieJar')
|
||||
|
||||
if isinstance(cookies, dict):
|
||||
cookiejar = cookiejar_from_dict(
|
||||
cookies, cookiejar=cookiejar, overwrite=False)
|
||||
elif isinstance(cookies, cookielib.CookieJar):
|
||||
try:
|
||||
cookiejar.update(cookies)
|
||||
except AttributeError:
|
||||
for cookie_in_jar in cookies:
|
||||
cookiejar.set_cookie(cookie_in_jar)
|
||||
|
||||
return cookiejar
|
||||
472
requests/core.py
472
requests/core.py
@@ -1,472 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.core
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
This module implements the main Requests system.
|
||||
|
||||
:copyright: (c) 2011 by Kenneth Reitz.
|
||||
:license: ISC, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
import urllib
|
||||
import urllib2
|
||||
|
||||
from urllib2 import HTTPError
|
||||
|
||||
try:
|
||||
import eventlet
|
||||
eventlet.monkey_patch()
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
if not 'eventlet' in locals():
|
||||
try:
|
||||
from gevent import monkey
|
||||
monkey.patch_all()
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
from .packages.poster.encode import multipart_encode
|
||||
from .packages.poster.streaminghttp import register_openers
|
||||
|
||||
|
||||
__title__ = 'requests'
|
||||
__version__ = '0.2.3'
|
||||
__build__ = 0x000203
|
||||
__author__ = 'Kenneth Reitz'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = 'Copyright 2011 Kenneth Reitz'
|
||||
|
||||
|
||||
AUTOAUTHS = []
|
||||
|
||||
|
||||
class _Request(urllib2.Request):
|
||||
"""Hidden wrapper around the urllib2.Request object. Allows for manual
|
||||
setting of HTTP methods.
|
||||
"""
|
||||
|
||||
def __init__(self, url, data=None, headers={}, origin_req_host=None, unverifiable=False, method=None):
|
||||
urllib2.Request.__init__( self, url, data, headers, origin_req_host, unverifiable)
|
||||
self.method = method
|
||||
|
||||
def get_method(self):
|
||||
if self.method:
|
||||
return self.method
|
||||
|
||||
return urllib2.Request.get_method(self)
|
||||
|
||||
|
||||
class Request(object):
|
||||
"""The :class:`Request` object. It carries out all functionality of
|
||||
Requests. Recommended interface is with the Requests functions.
|
||||
"""
|
||||
|
||||
_METHODS = ('GET', 'HEAD', 'PUT', 'POST', 'DELETE')
|
||||
|
||||
def __init__(self):
|
||||
self.url = None
|
||||
self.headers = dict()
|
||||
self.files = None
|
||||
self.method = None
|
||||
self.params = {}
|
||||
self.data = {}
|
||||
self.response = Response()
|
||||
|
||||
self.auth = None
|
||||
self.cookiejar = None
|
||||
self.sent = False
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return '<Request [%s]>' % (self.method)
|
||||
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
if (name == 'method') and (value):
|
||||
if not value in self._METHODS:
|
||||
raise InvalidMethod()
|
||||
|
||||
object.__setattr__(self, name, value)
|
||||
|
||||
|
||||
def _checks(self):
|
||||
"""Deterministic checks for consistency."""
|
||||
|
||||
if not self.url:
|
||||
raise URLRequired
|
||||
|
||||
|
||||
def _get_opener(self):
|
||||
"""Creates appropriate opener object for urllib2."""
|
||||
|
||||
_handlers = []
|
||||
|
||||
if self.auth or self.cookiejar:
|
||||
|
||||
if self.auth:
|
||||
|
||||
authr = urllib2.HTTPPasswordMgrWithDefaultRealm()
|
||||
|
||||
authr.add_password(None, self.url, self.auth.username, self.auth.password)
|
||||
auth_handler = urllib2.HTTPBasicAuthHandler(authr)
|
||||
|
||||
_handlers.append(auth_handler)
|
||||
|
||||
if self.cookiejar:
|
||||
|
||||
cookie_handler = urllib2.HTTPCookieProcessor(cookiejar)
|
||||
_handlers.append(cookie_handler)
|
||||
|
||||
opener = urllib2.build_opener(*_handlers)
|
||||
return opener.open
|
||||
|
||||
else:
|
||||
return urllib2.urlopen
|
||||
|
||||
|
||||
def _build_response(self, resp):
|
||||
"""Build internal Response object from given response."""
|
||||
|
||||
self.response.status_code = resp.code
|
||||
self.response.headers = resp.info().dict
|
||||
self.response.content = resp.read()
|
||||
self.response.url = resp.url
|
||||
|
||||
|
||||
def send(self, anyway=False):
|
||||
"""Sends the request. Returns True of successful, false if not.
|
||||
If there was an HTTPError during transmission,
|
||||
self.response.status_code will contain the HTTPError code.
|
||||
|
||||
Once a request is successfully sent, `sent` will equal True.
|
||||
|
||||
:param anyway: If True, request will be sent, even if it has
|
||||
already been sent.
|
||||
"""
|
||||
|
||||
self._checks()
|
||||
|
||||
success = False
|
||||
|
||||
|
||||
if self.method in ('GET', 'HEAD', 'DELETE'):
|
||||
if (not self.sent) or anyway:
|
||||
|
||||
# url encode GET params if it's a dict
|
||||
if isinstance(self.params, dict):
|
||||
params = urllib.urlencode(self.params)
|
||||
else:
|
||||
params = self.params
|
||||
|
||||
req = _Request(("%s?%s" % (self.url, params)), method=self.method)
|
||||
|
||||
if self.headers:
|
||||
req.headers = self.headers
|
||||
|
||||
opener = self._get_opener()
|
||||
|
||||
try:
|
||||
resp = opener(req)
|
||||
self._build_response(resp)
|
||||
self.response.ok = True
|
||||
|
||||
except urllib2.HTTPError as why:
|
||||
self._build_response(why)
|
||||
self.response.error = why
|
||||
|
||||
|
||||
elif self.method == 'PUT':
|
||||
if (not self.sent) or anyway:
|
||||
|
||||
if self.files:
|
||||
register_openers()
|
||||
datagen, headers = multipart_encode(self.files)
|
||||
req = _Request(self.url, data=datagen, headers=headers, method='PUT')
|
||||
|
||||
if self.headers:
|
||||
req.headers.update(self.headers)
|
||||
|
||||
else:
|
||||
|
||||
req = _Request(self.url, method='PUT')
|
||||
|
||||
if self.headers:
|
||||
req.headers = self.headers
|
||||
|
||||
req.data = self.data
|
||||
|
||||
try:
|
||||
opener = self._get_opener()
|
||||
resp = opener(req)
|
||||
|
||||
self._build_response(resp)
|
||||
self.response.ok = True
|
||||
|
||||
except urllib2.HTTPError as why:
|
||||
self._build_response(why)
|
||||
self.response.error = why
|
||||
|
||||
|
||||
elif self.method == 'POST':
|
||||
if (not self.sent) or anyway:
|
||||
|
||||
if self.files:
|
||||
register_openers()
|
||||
datagen, headers = multipart_encode(self.files)
|
||||
req = _Request(self.url, data=datagen, headers=headers, method='POST')
|
||||
|
||||
if self.headers:
|
||||
req.headers.update(self.headers)
|
||||
|
||||
else:
|
||||
req = _Request(self.url, method='POST')
|
||||
req.headers = self.headers
|
||||
|
||||
# url encode form data if it's a dict
|
||||
if isinstance(self.data, dict):
|
||||
req.data = urllib.urlencode(self.data)
|
||||
else:
|
||||
req.data = self.data
|
||||
|
||||
try:
|
||||
opener = self._get_opener()
|
||||
resp = opener(req)
|
||||
|
||||
self._build_response(resp)
|
||||
self.response.ok = True
|
||||
|
||||
except urllib2.HTTPError as why:
|
||||
self._build_response(why)
|
||||
self.response.error = why
|
||||
|
||||
self.sent = self.response.ok
|
||||
|
||||
return self.sent
|
||||
|
||||
|
||||
class Response(object):
|
||||
"""The :class:`Request` object. All :class:`Request` objects contain a
|
||||
:class:`Request.response <response>` attribute, which is an instance of
|
||||
this class.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.content = None
|
||||
self.status_code = None
|
||||
self.headers = dict()
|
||||
self.url = None
|
||||
self.ok = False
|
||||
self.error = None
|
||||
|
||||
def __repr__(self):
|
||||
return '<Response [%s]>' % (self.status_code)
|
||||
|
||||
def __nonzero__(self):
|
||||
"""Returns true if status_code is 'OK'."""
|
||||
return not self.error
|
||||
|
||||
def raise_for_status(self):
|
||||
"""Raises stored HTTPError if one exists."""
|
||||
if self.error:
|
||||
raise self.error
|
||||
|
||||
|
||||
|
||||
class AuthObject(object):
|
||||
"""The :class:`AuthObject` is a simple HTTP Authentication token. When
|
||||
given to a Requests function, it enables Basic HTTP Authentication for that
|
||||
Request. You can also enable Authorization for domain realms with AutoAuth.
|
||||
See AutoAuth for more details.
|
||||
|
||||
:param username: Username to authenticate with.
|
||||
:param password: Password for given username.
|
||||
"""
|
||||
|
||||
def __init__(self, username, password):
|
||||
self.username = username
|
||||
self.password = password
|
||||
|
||||
|
||||
|
||||
def get(url, params={}, headers={}, cookies=None, auth=None):
|
||||
"""Sends a GET request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`.
|
||||
:param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`.
|
||||
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
|
||||
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
|
||||
"""
|
||||
|
||||
r = Request()
|
||||
|
||||
r.method = 'GET'
|
||||
r.url = url
|
||||
r.params = params
|
||||
r.headers = headers
|
||||
r.cookiejar = cookies
|
||||
r.auth = _detect_auth(url, auth)
|
||||
|
||||
r.send()
|
||||
|
||||
return r.response
|
||||
|
||||
|
||||
def head(url, params={}, headers={}, cookies=None, auth=None):
|
||||
"""Sends a HEAD request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`.
|
||||
:param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.
|
||||
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
|
||||
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
|
||||
"""
|
||||
|
||||
r = Request()
|
||||
|
||||
r.method = 'HEAD'
|
||||
r.url = url
|
||||
# return response object
|
||||
r.params = params
|
||||
r.headers = headers
|
||||
r.cookiejar = cookies
|
||||
r.auth = _detect_auth(url, auth)
|
||||
|
||||
r.send()
|
||||
|
||||
return r.response
|
||||
|
||||
|
||||
def post(url, data={}, headers={}, files=None, cookies=None, auth=None):
|
||||
"""Sends a POST request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param data: (optional) Dictionary of POST Data to send with the :class:`Request`.
|
||||
:param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.
|
||||
:param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.
|
||||
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
|
||||
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
|
||||
"""
|
||||
|
||||
r = Request()
|
||||
|
||||
r.url = url
|
||||
r.method = 'POST'
|
||||
r.data = data
|
||||
|
||||
if files:
|
||||
r.files = files
|
||||
|
||||
r.headers = headers
|
||||
r.cookiejar = cookies
|
||||
r.auth = _detect_auth(url, auth)
|
||||
|
||||
r.send()
|
||||
|
||||
return r.response
|
||||
|
||||
|
||||
def put(url, data='', headers={}, files={}, cookies=None, auth=None):
|
||||
"""Sends a PUT request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param data: (optional) Bytes of PUT Data to send with the :class:`Request`.
|
||||
:param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.
|
||||
:param files: (optional) Dictionary of 'filename': file-like-objects for multipart encoding upload.
|
||||
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
|
||||
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
|
||||
"""
|
||||
|
||||
r = Request()
|
||||
|
||||
r.url = url
|
||||
r.method = 'PUT'
|
||||
r.data = data
|
||||
r.files = files
|
||||
r.headers = headers
|
||||
r.cookiejar = cookies
|
||||
r.auth = _detect_auth(url, auth)
|
||||
|
||||
r.send()
|
||||
|
||||
return r.response
|
||||
|
||||
|
||||
def delete(url, params={}, headers={}, cookies=None, auth=None):
|
||||
"""Sends a DELETE request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param params: (optional) Dictionary of GET Parameters to send with the :class:`Request`.
|
||||
:param headers: (optional) Dictionary of HTTP Headers to sent with the :class:`Request`.
|
||||
:param cookies: (optional) CookieJar object to send with the :class:`Request`.
|
||||
:param auth: (optional) AuthObject to enable Basic HTTP Auth.
|
||||
"""
|
||||
|
||||
r = Request()
|
||||
|
||||
r.url = url
|
||||
r.method = 'DELETE'
|
||||
|
||||
r.headers = headers
|
||||
r.cookiejar = cookies
|
||||
r.auth = _detect_auth(url, auth)
|
||||
|
||||
r.send()
|
||||
|
||||
return r.response
|
||||
|
||||
|
||||
def add_autoauth(url, authobject):
|
||||
"""Registers given AuthObject to given URL domain. for auto-activation.
|
||||
Once a URL is registered with an AuthObject, the configured HTTP
|
||||
Authentication will be used for all requests with URLS containing the given
|
||||
URL string.
|
||||
|
||||
Example: ::
|
||||
>>> c_auth = requests.AuthObject('kennethreitz', 'xxxxxxx')
|
||||
>>> requests.add_autoauth('https://convore.com/api/', c_auth)
|
||||
>>> r = requests.get('https://convore.com/api/account/verify.json')
|
||||
# Automatically HTTP Authenticated! Wh00t!
|
||||
|
||||
:param url: Base URL for given AuthObject to auto-activate for.
|
||||
:param authobject: AuthObject to auto-activate.
|
||||
"""
|
||||
|
||||
global AUTOAUTHS
|
||||
|
||||
AUTOAUTHS.append((url, authobject))
|
||||
|
||||
|
||||
def _detect_auth(url, auth):
|
||||
"""Returns registered AuthObject for given url if available, defaulting to
|
||||
given AuthObject.
|
||||
"""
|
||||
|
||||
return _get_autoauth(url) if not auth else auth
|
||||
|
||||
|
||||
def _get_autoauth(url):
|
||||
"""Returns registered AuthObject for given url if available."""
|
||||
|
||||
for (autoauth_url, auth) in AUTOAUTHS:
|
||||
if autoauth_url in url:
|
||||
return auth
|
||||
|
||||
return None
|
||||
|
||||
|
||||
class RequestException(Exception):
|
||||
"""There was an ambiguous exception that occured while handling your request."""
|
||||
|
||||
class AuthenticationError(RequestException):
|
||||
"""The authentication credentials provided were invalid."""
|
||||
|
||||
class URLRequired(RequestException):
|
||||
"""A valid URL is required to make a request."""
|
||||
|
||||
class InvalidMethod(RequestException):
|
||||
"""An inappropriate method was attempted."""
|
||||
122
requests/exceptions.py
Normal file
122
requests/exceptions.py
Normal file
@@ -0,0 +1,122 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.exceptions
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This module contains the set of Requests' exceptions.
|
||||
"""
|
||||
from urllib3.exceptions import HTTPError as BaseHTTPError
|
||||
|
||||
|
||||
class RequestException(IOError):
|
||||
"""There was an ambiguous exception that occurred while handling your
|
||||
request.
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Initialize RequestException with `request` and `response` objects."""
|
||||
response = kwargs.pop('response', None)
|
||||
self.response = response
|
||||
self.request = kwargs.pop('request', None)
|
||||
if (response is not None and not self.request and
|
||||
hasattr(response, 'request')):
|
||||
self.request = self.response.request
|
||||
super(RequestException, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class HTTPError(RequestException):
|
||||
"""An HTTP error occurred."""
|
||||
|
||||
|
||||
class ConnectionError(RequestException):
|
||||
"""A Connection error occurred."""
|
||||
|
||||
|
||||
class ProxyError(ConnectionError):
|
||||
"""A proxy error occurred."""
|
||||
|
||||
|
||||
class SSLError(ConnectionError):
|
||||
"""An SSL error occurred."""
|
||||
|
||||
|
||||
class Timeout(RequestException):
|
||||
"""The request timed out.
|
||||
|
||||
Catching this error will catch both
|
||||
:exc:`~requests.exceptions.ConnectTimeout` and
|
||||
:exc:`~requests.exceptions.ReadTimeout` errors.
|
||||
"""
|
||||
|
||||
|
||||
class ConnectTimeout(ConnectionError, Timeout):
|
||||
"""The request timed out while trying to connect to the remote server.
|
||||
|
||||
Requests that produced this error are safe to retry.
|
||||
"""
|
||||
|
||||
|
||||
class ReadTimeout(Timeout):
|
||||
"""The server did not send any data in the allotted amount of time."""
|
||||
|
||||
|
||||
class URLRequired(RequestException):
|
||||
"""A valid URL is required to make a request."""
|
||||
|
||||
|
||||
class TooManyRedirects(RequestException):
|
||||
"""Too many redirects."""
|
||||
|
||||
|
||||
class MissingSchema(RequestException, ValueError):
|
||||
"""The URL schema (e.g. http or https) is missing."""
|
||||
|
||||
|
||||
class InvalidSchema(RequestException, ValueError):
|
||||
"""See defaults.py for valid schemas."""
|
||||
|
||||
|
||||
class InvalidURL(RequestException, ValueError):
|
||||
"""The URL provided was somehow invalid."""
|
||||
|
||||
|
||||
class InvalidHeader(RequestException, ValueError):
|
||||
"""The header value provided was somehow invalid."""
|
||||
|
||||
|
||||
class ChunkedEncodingError(RequestException):
|
||||
"""The server declared chunked encoding but sent an invalid chunk."""
|
||||
|
||||
|
||||
class ContentDecodingError(RequestException, BaseHTTPError):
|
||||
"""Failed to decode response content"""
|
||||
|
||||
|
||||
class StreamConsumedError(RequestException, TypeError):
|
||||
"""The content for this response was already consumed"""
|
||||
|
||||
|
||||
class RetryError(RequestException):
|
||||
"""Custom retries logic failed"""
|
||||
|
||||
|
||||
class UnrewindableBodyError(RequestException):
|
||||
"""Requests encountered an error when trying to rewind a body"""
|
||||
|
||||
# Warnings
|
||||
|
||||
|
||||
class RequestsWarning(Warning):
|
||||
"""Base warning for Requests."""
|
||||
pass
|
||||
|
||||
|
||||
class FileModeWarning(RequestsWarning, DeprecationWarning):
|
||||
"""A file was opened in text mode, but Requests determined its binary length."""
|
||||
pass
|
||||
|
||||
|
||||
class RequestsDependencyWarning(RequestsWarning):
|
||||
"""An imported dependency doesn't match the expected version range."""
|
||||
pass
|
||||
120
requests/help.py
Normal file
120
requests/help.py
Normal file
@@ -0,0 +1,120 @@
|
||||
"""Module containing bug report helper(s)."""
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
import platform
|
||||
import sys
|
||||
import ssl
|
||||
|
||||
import idna
|
||||
import urllib3
|
||||
import chardet
|
||||
|
||||
from . import __version__ as requests_version
|
||||
|
||||
try:
|
||||
from .packages.urllib3.contrib import pyopenssl
|
||||
except ImportError:
|
||||
pyopenssl = None
|
||||
OpenSSL = None
|
||||
cryptography = None
|
||||
else:
|
||||
import OpenSSL
|
||||
import cryptography
|
||||
|
||||
|
||||
def _implementation():
|
||||
"""Return a dict with the Python implementation and version.
|
||||
|
||||
Provide both the name and the version of the Python implementation
|
||||
currently running. For example, on CPython 2.7.5 it will return
|
||||
{'name': 'CPython', 'version': '2.7.5'}.
|
||||
|
||||
This function works best on CPython and PyPy: in particular, it probably
|
||||
doesn't work for Jython or IronPython. Future investigation should be done
|
||||
to work out the correct shape of the code for those platforms.
|
||||
"""
|
||||
implementation = platform.python_implementation()
|
||||
|
||||
if implementation == 'CPython':
|
||||
implementation_version = platform.python_version()
|
||||
elif implementation == 'PyPy':
|
||||
implementation_version = '%s.%s.%s' % (sys.pypy_version_info.major,
|
||||
sys.pypy_version_info.minor,
|
||||
sys.pypy_version_info.micro)
|
||||
if sys.pypy_version_info.releaselevel != 'final':
|
||||
implementation_version = ''.join([
|
||||
implementation_version, sys.pypy_version_info.releaselevel
|
||||
])
|
||||
elif implementation == 'Jython':
|
||||
implementation_version = platform.python_version() # Complete Guess
|
||||
elif implementation == 'IronPython':
|
||||
implementation_version = platform.python_version() # Complete Guess
|
||||
else:
|
||||
implementation_version = 'Unknown'
|
||||
|
||||
return {'name': implementation, 'version': implementation_version}
|
||||
|
||||
|
||||
def info():
|
||||
"""Generate information for a bug report."""
|
||||
try:
|
||||
platform_info = {
|
||||
'system': platform.system(),
|
||||
'release': platform.release(),
|
||||
}
|
||||
except IOError:
|
||||
platform_info = {
|
||||
'system': 'Unknown',
|
||||
'release': 'Unknown',
|
||||
}
|
||||
|
||||
implementation_info = _implementation()
|
||||
urllib3_info = {'version': urllib3.__version__}
|
||||
chardet_info = {'version': chardet.__version__}
|
||||
|
||||
pyopenssl_info = {
|
||||
'version': None,
|
||||
'openssl_version': '',
|
||||
}
|
||||
if OpenSSL:
|
||||
pyopenssl_info = {
|
||||
'version': OpenSSL.__version__,
|
||||
'openssl_version': '%x' % OpenSSL.SSL.OPENSSL_VERSION_NUMBER,
|
||||
}
|
||||
cryptography_info = {
|
||||
'version': getattr(cryptography, '__version__', ''),
|
||||
}
|
||||
idna_info = {
|
||||
'version': getattr(idna, '__version__', ''),
|
||||
}
|
||||
|
||||
# OPENSSL_VERSION_NUMBER doesn't exist in the Python 2.6 ssl module.
|
||||
system_ssl = getattr(ssl, 'OPENSSL_VERSION_NUMBER', None)
|
||||
system_ssl_info = {
|
||||
'version': '%x' % system_ssl if system_ssl is not None else ''
|
||||
}
|
||||
|
||||
return {
|
||||
'platform': platform_info,
|
||||
'implementation': implementation_info,
|
||||
'system_ssl': system_ssl_info,
|
||||
'using_pyopenssl': pyopenssl is not None,
|
||||
'pyOpenSSL': pyopenssl_info,
|
||||
'urllib3': urllib3_info,
|
||||
'chardet': chardet_info,
|
||||
'cryptography': cryptography_info,
|
||||
'idna': idna_info,
|
||||
'requests': {
|
||||
'version': requests_version,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
"""Pretty-print the bug information as JSON."""
|
||||
print(json.dumps(info(), sort_keys=True, indent=2))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
34
requests/hooks.py
Normal file
34
requests/hooks.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.hooks
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
This module provides the capabilities for the Requests hooks system.
|
||||
|
||||
Available hooks:
|
||||
|
||||
``response``:
|
||||
The response generated from a Request.
|
||||
"""
|
||||
HOOKS = ['response']
|
||||
|
||||
|
||||
def default_hooks():
|
||||
return dict((event, []) for event in HOOKS)
|
||||
|
||||
# TODO: response is the only one
|
||||
|
||||
|
||||
def dispatch_hook(key, hooks, hook_data, **kwargs):
|
||||
"""Dispatches a hook dictionary on a given piece of data."""
|
||||
hooks = hooks or dict()
|
||||
hooks = hooks.get(key)
|
||||
if hooks:
|
||||
if hasattr(hooks, '__call__'):
|
||||
hooks = [hooks]
|
||||
for hook in hooks:
|
||||
_hook_data = hook(hook_data, **kwargs)
|
||||
if _hook_data is not None:
|
||||
hook_data = _hook_data
|
||||
return hook_data
|
||||
948
requests/models.py
Normal file
948
requests/models.py
Normal file
@@ -0,0 +1,948 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.models
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
This module contains the primary objects that power Requests.
|
||||
"""
|
||||
|
||||
import collections
|
||||
import datetime
|
||||
import sys
|
||||
|
||||
# Import encoding now, to avoid implicit import later.
|
||||
# Implicit import within threads may cause LookupError when standard library is in a ZIP,
|
||||
# such as in Embedded Python. See https://github.com/requests/requests/issues/3578.
|
||||
import encodings.idna
|
||||
|
||||
from urllib3.fields import RequestField
|
||||
from urllib3.filepost import encode_multipart_formdata
|
||||
from urllib3.util import parse_url
|
||||
from urllib3.exceptions import (
|
||||
DecodeError, ReadTimeoutError, ProtocolError, LocationParseError)
|
||||
|
||||
from io import UnsupportedOperation
|
||||
from .hooks import default_hooks
|
||||
from .structures import CaseInsensitiveDict
|
||||
|
||||
from .auth import HTTPBasicAuth
|
||||
from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar
|
||||
from .exceptions import (
|
||||
HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError,
|
||||
ContentDecodingError, ConnectionError, StreamConsumedError)
|
||||
from ._internal_utils import to_native_string, unicode_is_ascii
|
||||
from .utils import (
|
||||
guess_filename, get_auth_from_url, requote_uri,
|
||||
stream_decode_response_unicode, to_key_val_list, parse_header_links,
|
||||
iter_slices, guess_json_utf, super_len, check_header_validity)
|
||||
from .compat import (
|
||||
cookielib, urlunparse, urlsplit, urlencode, str, bytes,
|
||||
is_py2, chardet, builtin_str, basestring)
|
||||
from .compat import json as complexjson
|
||||
from .status_codes import codes
|
||||
|
||||
#: The set of HTTP status codes that indicate an automatically
|
||||
#: processable redirect.
|
||||
REDIRECT_STATI = (
|
||||
codes.moved, # 301
|
||||
codes.found, # 302
|
||||
codes.other, # 303
|
||||
codes.temporary_redirect, # 307
|
||||
codes.permanent_redirect, # 308
|
||||
)
|
||||
|
||||
DEFAULT_REDIRECT_LIMIT = 30
|
||||
CONTENT_CHUNK_SIZE = 10 * 1024
|
||||
ITER_CHUNK_SIZE = 512
|
||||
|
||||
|
||||
class RequestEncodingMixin(object):
|
||||
@property
|
||||
def path_url(self):
|
||||
"""Build the path URL to use."""
|
||||
|
||||
url = []
|
||||
|
||||
p = urlsplit(self.url)
|
||||
|
||||
path = p.path
|
||||
if not path:
|
||||
path = '/'
|
||||
|
||||
url.append(path)
|
||||
|
||||
query = p.query
|
||||
if query:
|
||||
url.append('?')
|
||||
url.append(query)
|
||||
|
||||
return ''.join(url)
|
||||
|
||||
@staticmethod
|
||||
def _encode_params(data):
|
||||
"""Encode parameters in a piece of data.
|
||||
|
||||
Will successfully encode parameters when passed as a dict or a list of
|
||||
2-tuples. Order is retained if data is a list of 2-tuples but arbitrary
|
||||
if parameters are supplied as a dict.
|
||||
"""
|
||||
|
||||
if isinstance(data, (str, bytes)):
|
||||
return data
|
||||
elif hasattr(data, 'read'):
|
||||
return data
|
||||
elif hasattr(data, '__iter__'):
|
||||
result = []
|
||||
for k, vs in to_key_val_list(data):
|
||||
if isinstance(vs, basestring) or not hasattr(vs, '__iter__'):
|
||||
vs = [vs]
|
||||
for v in vs:
|
||||
if v is not None:
|
||||
result.append(
|
||||
(k.encode('utf-8') if isinstance(k, str) else k,
|
||||
v.encode('utf-8') if isinstance(v, str) else v))
|
||||
return urlencode(result, doseq=True)
|
||||
else:
|
||||
return data
|
||||
|
||||
@staticmethod
|
||||
def _encode_files(files, data):
|
||||
"""Build the body for a multipart/form-data request.
|
||||
|
||||
Will successfully encode files when passed as a dict or a list of
|
||||
tuples. Order is retained if data is a list of tuples but arbitrary
|
||||
if parameters are supplied as a dict.
|
||||
The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype)
|
||||
or 4-tuples (filename, fileobj, contentype, custom_headers).
|
||||
"""
|
||||
if (not files):
|
||||
raise ValueError("Files must be provided.")
|
||||
elif isinstance(data, basestring):
|
||||
raise ValueError("Data must not be a string.")
|
||||
|
||||
new_fields = []
|
||||
fields = to_key_val_list(data or {})
|
||||
files = to_key_val_list(files or {})
|
||||
|
||||
for field, val in fields:
|
||||
if isinstance(val, basestring) or not hasattr(val, '__iter__'):
|
||||
val = [val]
|
||||
for v in val:
|
||||
if v is not None:
|
||||
# Don't call str() on bytestrings: in Py3 it all goes wrong.
|
||||
if not isinstance(v, bytes):
|
||||
v = str(v)
|
||||
|
||||
new_fields.append(
|
||||
(field.decode('utf-8') if isinstance(field, bytes) else field,
|
||||
v.encode('utf-8') if isinstance(v, str) else v))
|
||||
|
||||
for (k, v) in files:
|
||||
# support for explicit filename
|
||||
ft = None
|
||||
fh = None
|
||||
if isinstance(v, (tuple, list)):
|
||||
if len(v) == 2:
|
||||
fn, fp = v
|
||||
elif len(v) == 3:
|
||||
fn, fp, ft = v
|
||||
else:
|
||||
fn, fp, ft, fh = v
|
||||
else:
|
||||
fn = guess_filename(v) or k
|
||||
fp = v
|
||||
|
||||
if isinstance(fp, (str, bytes, bytearray)):
|
||||
fdata = fp
|
||||
else:
|
||||
fdata = fp.read()
|
||||
|
||||
rf = RequestField(name=k, data=fdata, filename=fn, headers=fh)
|
||||
rf.make_multipart(content_type=ft)
|
||||
new_fields.append(rf)
|
||||
|
||||
body, content_type = encode_multipart_formdata(new_fields)
|
||||
|
||||
return body, content_type
|
||||
|
||||
|
||||
class RequestHooksMixin(object):
|
||||
def register_hook(self, event, hook):
|
||||
"""Properly register a hook."""
|
||||
|
||||
if event not in self.hooks:
|
||||
raise ValueError('Unsupported event specified, with event name "%s"' % (event))
|
||||
|
||||
if isinstance(hook, collections.Callable):
|
||||
self.hooks[event].append(hook)
|
||||
elif hasattr(hook, '__iter__'):
|
||||
self.hooks[event].extend(h for h in hook if isinstance(h, collections.Callable))
|
||||
|
||||
def deregister_hook(self, event, hook):
|
||||
"""Deregister a previously registered hook.
|
||||
Returns True if the hook existed, False if not.
|
||||
"""
|
||||
|
||||
try:
|
||||
self.hooks[event].remove(hook)
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
class Request(RequestHooksMixin):
|
||||
"""A user-created :class:`Request <Request>` object.
|
||||
|
||||
Used to prepare a :class:`PreparedRequest <PreparedRequest>`, which is sent to the server.
|
||||
|
||||
:param method: HTTP method to use.
|
||||
:param url: URL to send.
|
||||
:param headers: dictionary of headers to send.
|
||||
:param files: dictionary of {filename: fileobject} files to multipart upload.
|
||||
:param data: the body to attach to the request. If a dictionary is provided, form-encoding will take place.
|
||||
:param json: json for the body to attach to the request (if files or data is not specified).
|
||||
:param params: dictionary of URL parameters to append to the URL.
|
||||
:param auth: Auth handler or (user, pass) tuple.
|
||||
:param cookies: dictionary or CookieJar of cookies to attach to this request.
|
||||
:param hooks: dictionary of callback hooks, for internal usage.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> import requests
|
||||
>>> req = requests.Request('GET', 'http://httpbin.org/get')
|
||||
>>> req.prepare()
|
||||
<PreparedRequest [GET]>
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
method=None, url=None, headers=None, files=None, data=None,
|
||||
params=None, auth=None, cookies=None, hooks=None, json=None):
|
||||
|
||||
# Default empty dicts for dict params.
|
||||
data = [] if data is None else data
|
||||
files = [] if files is None else files
|
||||
headers = {} if headers is None else headers
|
||||
params = {} if params is None else params
|
||||
hooks = {} if hooks is None else hooks
|
||||
|
||||
self.hooks = default_hooks()
|
||||
for (k, v) in list(hooks.items()):
|
||||
self.register_hook(event=k, hook=v)
|
||||
|
||||
self.method = method
|
||||
self.url = url
|
||||
self.headers = headers
|
||||
self.files = files
|
||||
self.data = data
|
||||
self.json = json
|
||||
self.params = params
|
||||
self.auth = auth
|
||||
self.cookies = cookies
|
||||
|
||||
def __repr__(self):
|
||||
return '<Request [%s]>' % (self.method)
|
||||
|
||||
def prepare(self):
|
||||
"""Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it."""
|
||||
p = PreparedRequest()
|
||||
p.prepare(
|
||||
method=self.method,
|
||||
url=self.url,
|
||||
headers=self.headers,
|
||||
files=self.files,
|
||||
data=self.data,
|
||||
json=self.json,
|
||||
params=self.params,
|
||||
auth=self.auth,
|
||||
cookies=self.cookies,
|
||||
hooks=self.hooks,
|
||||
)
|
||||
return p
|
||||
|
||||
|
||||
class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
|
||||
"""The fully mutable :class:`PreparedRequest <PreparedRequest>` object,
|
||||
containing the exact bytes that will be sent to the server.
|
||||
|
||||
Generated from either a :class:`Request <Request>` object or manually.
|
||||
|
||||
Usage::
|
||||
|
||||
>>> import requests
|
||||
>>> req = requests.Request('GET', 'http://httpbin.org/get')
|
||||
>>> r = req.prepare()
|
||||
<PreparedRequest [GET]>
|
||||
|
||||
>>> s = requests.Session()
|
||||
>>> s.send(r)
|
||||
<Response [200]>
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
#: HTTP verb to send to the server.
|
||||
self.method = None
|
||||
#: HTTP URL to send the request to.
|
||||
self.url = None
|
||||
#: dictionary of HTTP headers.
|
||||
self.headers = None
|
||||
# The `CookieJar` used to create the Cookie header will be stored here
|
||||
# after prepare_cookies is called
|
||||
self._cookies = None
|
||||
#: request body to send to the server.
|
||||
self.body = None
|
||||
#: dictionary of callback hooks, for internal usage.
|
||||
self.hooks = default_hooks()
|
||||
#: integer denoting starting position of a readable file-like body.
|
||||
self._body_position = None
|
||||
|
||||
def prepare(self,
|
||||
method=None, url=None, headers=None, files=None, data=None,
|
||||
params=None, auth=None, cookies=None, hooks=None, json=None):
|
||||
"""Prepares the entire request with the given parameters."""
|
||||
|
||||
self.prepare_method(method)
|
||||
self.prepare_url(url, params)
|
||||
self.prepare_headers(headers)
|
||||
self.prepare_cookies(cookies)
|
||||
self.prepare_body(data, files, json)
|
||||
self.prepare_auth(auth, url)
|
||||
|
||||
# Note that prepare_auth must be last to enable authentication schemes
|
||||
# such as OAuth to work on a fully prepared request.
|
||||
|
||||
# This MUST go after prepare_auth. Authenticators could add a hook
|
||||
self.prepare_hooks(hooks)
|
||||
|
||||
def __repr__(self):
|
||||
return '<PreparedRequest [%s]>' % (self.method)
|
||||
|
||||
def copy(self):
|
||||
p = PreparedRequest()
|
||||
p.method = self.method
|
||||
p.url = self.url
|
||||
p.headers = self.headers.copy() if self.headers is not None else None
|
||||
p._cookies = _copy_cookie_jar(self._cookies)
|
||||
p.body = self.body
|
||||
p.hooks = self.hooks
|
||||
p._body_position = self._body_position
|
||||
return p
|
||||
|
||||
def prepare_method(self, method):
|
||||
"""Prepares the given HTTP method."""
|
||||
self.method = method
|
||||
if self.method is not None:
|
||||
self.method = to_native_string(self.method.upper())
|
||||
|
||||
@staticmethod
|
||||
def _get_idna_encoded_host(host):
|
||||
import idna
|
||||
|
||||
try:
|
||||
host = idna.encode(host, uts46=True).decode('utf-8')
|
||||
except idna.IDNAError:
|
||||
raise UnicodeError
|
||||
return host
|
||||
|
||||
def prepare_url(self, url, params):
|
||||
"""Prepares the given HTTP URL."""
|
||||
#: Accept objects that have string representations.
|
||||
#: We're unable to blindly call unicode/str functions
|
||||
#: as this will include the bytestring indicator (b'')
|
||||
#: on python 3.x.
|
||||
#: https://github.com/requests/requests/pull/2238
|
||||
if isinstance(url, bytes):
|
||||
url = url.decode('utf8')
|
||||
else:
|
||||
url = unicode(url) if is_py2 else str(url)
|
||||
|
||||
# Remove leading whitespaces from url
|
||||
url = url.lstrip()
|
||||
|
||||
# Don't do any URL preparation for non-HTTP schemes like `mailto`,
|
||||
# `data` etc to work around exceptions from `url_parse`, which
|
||||
# handles RFC 3986 only.
|
||||
if ':' in url and not url.lower().startswith('http'):
|
||||
self.url = url
|
||||
return
|
||||
|
||||
# Support for unicode domain names and paths.
|
||||
try:
|
||||
scheme, auth, host, port, path, query, fragment = parse_url(url)
|
||||
except LocationParseError as e:
|
||||
raise InvalidURL(*e.args)
|
||||
|
||||
if not scheme:
|
||||
error = ("Invalid URL {0!r}: No schema supplied. Perhaps you meant http://{0}?")
|
||||
error = error.format(to_native_string(url, 'utf8'))
|
||||
|
||||
raise MissingSchema(error)
|
||||
|
||||
if not host:
|
||||
raise InvalidURL("Invalid URL %r: No host supplied" % url)
|
||||
|
||||
# In general, we want to try IDNA encoding the hostname if the string contains
|
||||
# non-ASCII characters. This allows users to automatically get the correct IDNA
|
||||
# behaviour. For strings containing only ASCII characters, we need to also verify
|
||||
# it doesn't start with a wildcard (*), before allowing the unencoded hostname.
|
||||
if not unicode_is_ascii(host):
|
||||
try:
|
||||
host = self._get_idna_encoded_host(host)
|
||||
except UnicodeError:
|
||||
raise InvalidURL('URL has an invalid label.')
|
||||
elif host.startswith(u'*'):
|
||||
raise InvalidURL('URL has an invalid label.')
|
||||
|
||||
# Carefully reconstruct the network location
|
||||
netloc = auth or ''
|
||||
if netloc:
|
||||
netloc += '@'
|
||||
netloc += host
|
||||
if port:
|
||||
netloc += ':' + str(port)
|
||||
|
||||
# Bare domains aren't valid URLs.
|
||||
if not path:
|
||||
path = '/'
|
||||
|
||||
if is_py2:
|
||||
if isinstance(scheme, str):
|
||||
scheme = scheme.encode('utf-8')
|
||||
if isinstance(netloc, str):
|
||||
netloc = netloc.encode('utf-8')
|
||||
if isinstance(path, str):
|
||||
path = path.encode('utf-8')
|
||||
if isinstance(query, str):
|
||||
query = query.encode('utf-8')
|
||||
if isinstance(fragment, str):
|
||||
fragment = fragment.encode('utf-8')
|
||||
|
||||
if isinstance(params, (str, bytes)):
|
||||
params = to_native_string(params)
|
||||
|
||||
enc_params = self._encode_params(params)
|
||||
if enc_params:
|
||||
if query:
|
||||
query = '%s&%s' % (query, enc_params)
|
||||
else:
|
||||
query = enc_params
|
||||
|
||||
url = requote_uri(urlunparse([scheme, netloc, path, None, query, fragment]))
|
||||
self.url = url
|
||||
|
||||
def prepare_headers(self, headers):
|
||||
"""Prepares the given HTTP headers."""
|
||||
|
||||
self.headers = CaseInsensitiveDict()
|
||||
if headers:
|
||||
for header in headers.items():
|
||||
# Raise exception on invalid header value.
|
||||
check_header_validity(header)
|
||||
name, value = header
|
||||
self.headers[to_native_string(name)] = value
|
||||
|
||||
def prepare_body(self, data, files, json=None):
|
||||
"""Prepares the given HTTP body data."""
|
||||
|
||||
# Check if file, fo, generator, iterator.
|
||||
# If not, run through normal process.
|
||||
|
||||
# Nottin' on you.
|
||||
body = None
|
||||
content_type = None
|
||||
|
||||
if not data and json is not None:
|
||||
# urllib3 requires a bytes-like body. Python 2's json.dumps
|
||||
# provides this natively, but Python 3 gives a Unicode string.
|
||||
content_type = 'application/json'
|
||||
body = complexjson.dumps(json)
|
||||
if not isinstance(body, bytes):
|
||||
body = body.encode('utf-8')
|
||||
|
||||
is_stream = all([
|
||||
hasattr(data, '__iter__'),
|
||||
not isinstance(data, (basestring, list, tuple, collections.Mapping))
|
||||
])
|
||||
|
||||
try:
|
||||
length = super_len(data)
|
||||
except (TypeError, AttributeError, UnsupportedOperation):
|
||||
length = None
|
||||
|
||||
if is_stream:
|
||||
body = data
|
||||
|
||||
if getattr(body, 'tell', None) is not None:
|
||||
# Record the current file position before reading.
|
||||
# This will allow us to rewind a file in the event
|
||||
# of a redirect.
|
||||
try:
|
||||
self._body_position = body.tell()
|
||||
except (IOError, OSError):
|
||||
# This differentiates from None, allowing us to catch
|
||||
# a failed `tell()` later when trying to rewind the body
|
||||
self._body_position = object()
|
||||
|
||||
if files:
|
||||
raise NotImplementedError('Streamed bodies and files are mutually exclusive.')
|
||||
|
||||
if length:
|
||||
self.headers['Content-Length'] = builtin_str(length)
|
||||
else:
|
||||
self.headers['Transfer-Encoding'] = 'chunked'
|
||||
else:
|
||||
# Multi-part file uploads.
|
||||
if files:
|
||||
(body, content_type) = self._encode_files(files, data)
|
||||
else:
|
||||
if data:
|
||||
body = self._encode_params(data)
|
||||
if isinstance(data, basestring) or hasattr(data, 'read'):
|
||||
content_type = None
|
||||
else:
|
||||
content_type = 'application/x-www-form-urlencoded'
|
||||
|
||||
self.prepare_content_length(body)
|
||||
|
||||
# Add content-type if it wasn't explicitly provided.
|
||||
if content_type and ('content-type' not in self.headers):
|
||||
self.headers['Content-Type'] = content_type
|
||||
|
||||
self.body = body
|
||||
|
||||
def prepare_content_length(self, body):
|
||||
"""Prepare Content-Length header based on request method and body"""
|
||||
if body is not None:
|
||||
length = super_len(body)
|
||||
if length:
|
||||
# If length exists, set it. Otherwise, we fallback
|
||||
# to Transfer-Encoding: chunked.
|
||||
self.headers['Content-Length'] = builtin_str(length)
|
||||
elif self.method not in ('GET', 'HEAD') and self.headers.get('Content-Length') is None:
|
||||
# Set Content-Length to 0 for methods that can have a body
|
||||
# but don't provide one. (i.e. not GET or HEAD)
|
||||
self.headers['Content-Length'] = '0'
|
||||
|
||||
def prepare_auth(self, auth, url=''):
|
||||
"""Prepares the given HTTP auth data."""
|
||||
|
||||
# If no Auth is explicitly provided, extract it from the URL first.
|
||||
if auth is None:
|
||||
url_auth = get_auth_from_url(self.url)
|
||||
auth = url_auth if any(url_auth) else None
|
||||
|
||||
if auth:
|
||||
if isinstance(auth, tuple) and len(auth) == 2:
|
||||
# special-case basic HTTP auth
|
||||
auth = HTTPBasicAuth(*auth)
|
||||
|
||||
# Allow auth to make its changes.
|
||||
r = auth(self)
|
||||
|
||||
# Update self to reflect the auth changes.
|
||||
self.__dict__.update(r.__dict__)
|
||||
|
||||
# Recompute Content-Length
|
||||
self.prepare_content_length(self.body)
|
||||
|
||||
def prepare_cookies(self, cookies):
|
||||
"""Prepares the given HTTP cookie data.
|
||||
|
||||
This function eventually generates a ``Cookie`` header from the
|
||||
given cookies using cookielib. Due to cookielib's design, the header
|
||||
will not be regenerated if it already exists, meaning this function
|
||||
can only be called once for the life of the
|
||||
:class:`PreparedRequest <PreparedRequest>` object. Any subsequent calls
|
||||
to ``prepare_cookies`` will have no actual effect, unless the "Cookie"
|
||||
header is removed beforehand.
|
||||
"""
|
||||
if isinstance(cookies, cookielib.CookieJar):
|
||||
self._cookies = cookies
|
||||
else:
|
||||
self._cookies = cookiejar_from_dict(cookies)
|
||||
|
||||
cookie_header = get_cookie_header(self._cookies, self)
|
||||
if cookie_header is not None:
|
||||
self.headers['Cookie'] = cookie_header
|
||||
|
||||
def prepare_hooks(self, hooks):
|
||||
"""Prepares the given hooks."""
|
||||
# hooks can be passed as None to the prepare method and to this
|
||||
# method. To prevent iterating over None, simply use an empty list
|
||||
# if hooks is False-y
|
||||
hooks = hooks or []
|
||||
for event in hooks:
|
||||
self.register_hook(event, hooks[event])
|
||||
|
||||
|
||||
class Response(object):
|
||||
"""The :class:`Response <Response>` object, which contains a
|
||||
server's response to an HTTP request.
|
||||
"""
|
||||
|
||||
__attrs__ = [
|
||||
'_content', 'status_code', 'headers', 'url', 'history',
|
||||
'encoding', 'reason', 'cookies', 'elapsed', 'request'
|
||||
]
|
||||
|
||||
def __init__(self):
|
||||
self._content = False
|
||||
self._content_consumed = False
|
||||
self._next = None
|
||||
|
||||
#: Integer Code of responded HTTP Status, e.g. 404 or 200.
|
||||
self.status_code = None
|
||||
|
||||
#: Case-insensitive Dictionary of Response Headers.
|
||||
#: For example, ``headers['content-encoding']`` will return the
|
||||
#: value of a ``'Content-Encoding'`` response header.
|
||||
self.headers = CaseInsensitiveDict()
|
||||
|
||||
#: File-like object representation of response (for advanced usage).
|
||||
#: Use of ``raw`` requires that ``stream=True`` be set on the request.
|
||||
# This requirement does not apply for use internally to Requests.
|
||||
self.raw = None
|
||||
|
||||
#: Final URL location of Response.
|
||||
self.url = None
|
||||
|
||||
#: Encoding to decode with when accessing r.text.
|
||||
self.encoding = None
|
||||
|
||||
#: A list of :class:`Response <Response>` objects from
|
||||
#: the history of the Request. Any redirect responses will end
|
||||
#: up here. The list is sorted from the oldest to the most recent request.
|
||||
self.history = []
|
||||
|
||||
#: Textual reason of responded HTTP Status, e.g. "Not Found" or "OK".
|
||||
self.reason = None
|
||||
|
||||
#: A CookieJar of Cookies the server sent back.
|
||||
self.cookies = cookiejar_from_dict({})
|
||||
|
||||
#: The amount of time elapsed between sending the request
|
||||
#: and the arrival of the response (as a timedelta).
|
||||
#: This property specifically measures the time taken between sending
|
||||
#: the first byte of the request and finishing parsing the headers. It
|
||||
#: is therefore unaffected by consuming the response content or the
|
||||
#: value of the ``stream`` keyword argument.
|
||||
self.elapsed = datetime.timedelta(0)
|
||||
|
||||
#: The :class:`PreparedRequest <PreparedRequest>` object to which this
|
||||
#: is a response.
|
||||
self.request = None
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *args):
|
||||
self.close()
|
||||
|
||||
def __getstate__(self):
|
||||
# Consume everything; accessing the content attribute makes
|
||||
# sure the content has been fully read.
|
||||
if not self._content_consumed:
|
||||
self.content
|
||||
|
||||
return dict(
|
||||
(attr, getattr(self, attr, None))
|
||||
for attr in self.__attrs__
|
||||
)
|
||||
|
||||
def __setstate__(self, state):
|
||||
for name, value in state.items():
|
||||
setattr(self, name, value)
|
||||
|
||||
# pickled objects do not have .raw
|
||||
setattr(self, '_content_consumed', True)
|
||||
setattr(self, 'raw', None)
|
||||
|
||||
def __repr__(self):
|
||||
return '<Response [%s]>' % (self.status_code)
|
||||
|
||||
def __bool__(self):
|
||||
"""Returns True if :attr:`status_code` is less than 400.
|
||||
|
||||
This attribute checks if the status code of the response is between
|
||||
400 and 600 to see if there was a client error or a server error. If
|
||||
the status code, is between 200 and 400, this will return True. This
|
||||
is **not** a check to see if the response code is ``200 OK``.
|
||||
"""
|
||||
return self.ok
|
||||
|
||||
def __nonzero__(self):
|
||||
"""Returns True if :attr:`status_code` is less than 400.
|
||||
|
||||
This attribute checks if the status code of the response is between
|
||||
400 and 600 to see if there was a client error or a server error. If
|
||||
the status code, is between 200 and 400, this will return True. This
|
||||
is **not** a check to see if the response code is ``200 OK``.
|
||||
"""
|
||||
return self.ok
|
||||
|
||||
def __iter__(self):
|
||||
"""Allows you to use a response as an iterator."""
|
||||
return self.iter_content(128)
|
||||
|
||||
@property
|
||||
def ok(self):
|
||||
"""Returns True if :attr:`status_code` is less than 400.
|
||||
|
||||
This attribute checks if the status code of the response is between
|
||||
400 and 600 to see if there was a client error or a server error. If
|
||||
the status code, is between 200 and 400, this will return True. This
|
||||
is **not** a check to see if the response code is ``200 OK``.
|
||||
"""
|
||||
try:
|
||||
self.raise_for_status()
|
||||
except HTTPError:
|
||||
return False
|
||||
return True
|
||||
|
||||
@property
|
||||
def is_redirect(self):
|
||||
"""True if this Response is a well-formed HTTP redirect that could have
|
||||
been processed automatically (by :meth:`Session.resolve_redirects`).
|
||||
"""
|
||||
return ('location' in self.headers and self.status_code in REDIRECT_STATI)
|
||||
|
||||
@property
|
||||
def is_permanent_redirect(self):
|
||||
"""True if this Response one of the permanent versions of redirect."""
|
||||
return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect))
|
||||
|
||||
@property
|
||||
def next(self):
|
||||
"""Returns a PreparedRequest for the next request in a redirect chain, if there is one."""
|
||||
return self._next
|
||||
|
||||
@property
|
||||
def apparent_encoding(self):
|
||||
"""The apparent encoding, provided by the chardet library."""
|
||||
return chardet.detect(self.content)['encoding']
|
||||
|
||||
def iter_content(self, chunk_size=1, decode_unicode=False):
|
||||
"""Iterates over the response data. When stream=True is set on the
|
||||
request, this avoids reading the content at once into memory for
|
||||
large responses. The chunk size is the number of bytes it should
|
||||
read into memory. This is not necessarily the length of each item
|
||||
returned as decoding can take place.
|
||||
|
||||
chunk_size must be of type int or None. A value of None will
|
||||
function differently depending on the value of `stream`.
|
||||
stream=True will read data as it arrives in whatever size the
|
||||
chunks are received. If stream=False, data is returned as
|
||||
a single chunk.
|
||||
|
||||
If decode_unicode is True, content will be decoded using the best
|
||||
available encoding based on the response.
|
||||
"""
|
||||
|
||||
def generate():
|
||||
# Special case for urllib3.
|
||||
if hasattr(self.raw, 'stream'):
|
||||
try:
|
||||
for chunk in self.raw.stream(chunk_size, decode_content=True):
|
||||
yield chunk
|
||||
except ProtocolError as e:
|
||||
raise ChunkedEncodingError(e)
|
||||
except DecodeError as e:
|
||||
raise ContentDecodingError(e)
|
||||
except ReadTimeoutError as e:
|
||||
raise ConnectionError(e)
|
||||
else:
|
||||
# Standard file-like object.
|
||||
while True:
|
||||
chunk = self.raw.read(chunk_size)
|
||||
if not chunk:
|
||||
break
|
||||
yield chunk
|
||||
|
||||
self._content_consumed = True
|
||||
|
||||
if self._content_consumed and isinstance(self._content, bool):
|
||||
raise StreamConsumedError()
|
||||
elif chunk_size is not None and not isinstance(chunk_size, int):
|
||||
raise TypeError("chunk_size must be an int, it is instead a %s." % type(chunk_size))
|
||||
# simulate reading small chunks of the content
|
||||
reused_chunks = iter_slices(self._content, chunk_size)
|
||||
|
||||
stream_chunks = generate()
|
||||
|
||||
chunks = reused_chunks if self._content_consumed else stream_chunks
|
||||
|
||||
if decode_unicode:
|
||||
chunks = stream_decode_response_unicode(chunks, self)
|
||||
|
||||
return chunks
|
||||
|
||||
def iter_lines(self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=None, delimiter=None):
|
||||
"""Iterates over the response data, one line at a time. When
|
||||
stream=True is set on the request, this avoids reading the
|
||||
content at once into memory for large responses.
|
||||
|
||||
.. note:: This method is not reentrant safe.
|
||||
"""
|
||||
|
||||
pending = None
|
||||
|
||||
for chunk in self.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode):
|
||||
|
||||
if pending is not None:
|
||||
chunk = pending + chunk
|
||||
|
||||
if delimiter:
|
||||
lines = chunk.split(delimiter)
|
||||
else:
|
||||
lines = chunk.splitlines()
|
||||
|
||||
if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]:
|
||||
pending = lines.pop()
|
||||
else:
|
||||
pending = None
|
||||
|
||||
for line in lines:
|
||||
yield line
|
||||
|
||||
if pending is not None:
|
||||
yield pending
|
||||
|
||||
@property
|
||||
def content(self):
|
||||
"""Content of the response, in bytes."""
|
||||
|
||||
if self._content is False:
|
||||
# Read the contents.
|
||||
if self._content_consumed:
|
||||
raise RuntimeError(
|
||||
'The content for this response was already consumed')
|
||||
|
||||
if self.status_code == 0 or self.raw is None:
|
||||
self._content = None
|
||||
else:
|
||||
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
|
||||
|
||||
self._content_consumed = True
|
||||
# don't need to release the connection; that's been handled by urllib3
|
||||
# since we exhausted the data.
|
||||
return self._content
|
||||
|
||||
@property
|
||||
def text(self):
|
||||
"""Content of the response, in unicode.
|
||||
|
||||
If Response.encoding is None, encoding will be guessed using
|
||||
``chardet``.
|
||||
|
||||
The encoding of the response content is determined based solely on HTTP
|
||||
headers, following RFC 2616 to the letter. If you can take advantage of
|
||||
non-HTTP knowledge to make a better guess at the encoding, you should
|
||||
set ``r.encoding`` appropriately before accessing this property.
|
||||
"""
|
||||
|
||||
# Try charset from content-type
|
||||
content = None
|
||||
encoding = self.encoding
|
||||
|
||||
if not self.content:
|
||||
return str('')
|
||||
|
||||
# Fallback to auto-detected encoding.
|
||||
if self.encoding is None:
|
||||
encoding = self.apparent_encoding
|
||||
|
||||
# Decode unicode from given encoding.
|
||||
try:
|
||||
content = str(self.content, encoding, errors='replace')
|
||||
except (LookupError, TypeError):
|
||||
# A LookupError is raised if the encoding was not found which could
|
||||
# indicate a misspelling or similar mistake.
|
||||
#
|
||||
# A TypeError can be raised if encoding is None
|
||||
#
|
||||
# So we try blindly encoding.
|
||||
content = str(self.content, errors='replace')
|
||||
|
||||
return content
|
||||
|
||||
def json(self, **kwargs):
|
||||
r"""Returns the json-encoded content of a response, if any.
|
||||
|
||||
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
|
||||
:raises ValueError: If the response body does not contain valid json.
|
||||
"""
|
||||
|
||||
if not self.encoding and self.content and len(self.content) > 3:
|
||||
# No encoding set. JSON RFC 4627 section 3 states we should expect
|
||||
# UTF-8, -16 or -32. Detect which one to use; If the detection or
|
||||
# decoding fails, fall back to `self.text` (using chardet to make
|
||||
# a best guess).
|
||||
encoding = guess_json_utf(self.content)
|
||||
if encoding is not None:
|
||||
try:
|
||||
return complexjson.loads(
|
||||
self.content.decode(encoding), **kwargs
|
||||
)
|
||||
except UnicodeDecodeError:
|
||||
# Wrong UTF codec detected; usually because it's not UTF-8
|
||||
# but some other 8-bit codec. This is an RFC violation,
|
||||
# and the server didn't bother to tell us what codec *was*
|
||||
# used.
|
||||
pass
|
||||
return complexjson.loads(self.text, **kwargs)
|
||||
|
||||
@property
|
||||
def links(self):
|
||||
"""Returns the parsed header links of the response, if any."""
|
||||
|
||||
header = self.headers.get('link')
|
||||
|
||||
# l = MultiDict()
|
||||
l = {}
|
||||
|
||||
if header:
|
||||
links = parse_header_links(header)
|
||||
|
||||
for link in links:
|
||||
key = link.get('rel') or link.get('url')
|
||||
l[key] = link
|
||||
|
||||
return l
|
||||
|
||||
def raise_for_status(self):
|
||||
"""Raises stored :class:`HTTPError`, if one occurred."""
|
||||
|
||||
http_error_msg = ''
|
||||
if isinstance(self.reason, bytes):
|
||||
# We attempt to decode utf-8 first because some servers
|
||||
# choose to localize their reason strings. If the string
|
||||
# isn't utf-8, we fall back to iso-8859-1 for all other
|
||||
# encodings. (See PR #3538)
|
||||
try:
|
||||
reason = self.reason.decode('utf-8')
|
||||
except UnicodeDecodeError:
|
||||
reason = self.reason.decode('iso-8859-1')
|
||||
else:
|
||||
reason = self.reason
|
||||
|
||||
if 400 <= self.status_code < 500:
|
||||
http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
|
||||
|
||||
elif 500 <= self.status_code < 600:
|
||||
http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
|
||||
|
||||
if http_error_msg:
|
||||
raise HTTPError(http_error_msg, response=self)
|
||||
|
||||
def close(self):
|
||||
"""Releases the connection back to the pool. Once this method has been
|
||||
called the underlying ``raw`` object must not be accessed again.
|
||||
|
||||
*Note: Should not normally need to be called explicitly.*
|
||||
"""
|
||||
if not self._content_consumed:
|
||||
self.raw.close()
|
||||
|
||||
release_conn = getattr(self.raw, 'release_conn', None)
|
||||
if release_conn is not None:
|
||||
release_conn()
|
||||
14
requests/packages.py
Normal file
14
requests/packages.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
|
||||
# This code exists for backwards compatibility reasons.
|
||||
# I don't like it either. Just look the other way. :)
|
||||
|
||||
for package in ('urllib3', 'idna', 'chardet'):
|
||||
locals()[package] = __import__(package)
|
||||
# This traversal is apparently necessary such that the identities are
|
||||
# preserved (requests.packages.urllib3.* is urllib3.*)
|
||||
for mod in list(sys.modules):
|
||||
if mod == package or mod.startswith(package + '.'):
|
||||
sys.modules['requests.packages.' + mod] = sys.modules[mod]
|
||||
|
||||
# Kinda cool, though, right?
|
||||
@@ -1 +0,0 @@
|
||||
from . import poster
|
||||
@@ -1,32 +0,0 @@
|
||||
# Copyright (c) 2010 Chris AtLee
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
"""poster module
|
||||
|
||||
Support for streaming HTTP uploads, and multipart/form-data encoding
|
||||
|
||||
```poster.version``` is a 3-tuple of integers representing the version number.
|
||||
New releases of poster will always have a version number that compares greater
|
||||
than an older version of poster.
|
||||
New in version 0.6."""
|
||||
|
||||
from . import streaminghttp
|
||||
from . import encode
|
||||
|
||||
version = (0, 8, 0) # Thanks JP!
|
||||
@@ -1,414 +0,0 @@
|
||||
"""multipart/form-data encoding module
|
||||
|
||||
This module provides functions that faciliate encoding name/value pairs
|
||||
as multipart/form-data suitable for a HTTP POST or PUT request.
|
||||
|
||||
multipart/form-data is the standard way to upload files over HTTP"""
|
||||
|
||||
__all__ = ['gen_boundary', 'encode_and_quote', 'MultipartParam',
|
||||
'encode_string', 'encode_file_header', 'get_body_size', 'get_headers',
|
||||
'multipart_encode']
|
||||
|
||||
try:
|
||||
import uuid
|
||||
def gen_boundary():
|
||||
"""Returns a random string to use as the boundary for a message"""
|
||||
return uuid.uuid4().hex
|
||||
except ImportError:
|
||||
import random, sha
|
||||
def gen_boundary():
|
||||
"""Returns a random string to use as the boundary for a message"""
|
||||
bits = random.getrandbits(160)
|
||||
return sha.new(str(bits)).hexdigest()
|
||||
|
||||
import urllib, re, os, mimetypes
|
||||
try:
|
||||
from email.header import Header
|
||||
except ImportError:
|
||||
# Python 2.4
|
||||
from email.Header import Header
|
||||
|
||||
def encode_and_quote(data):
|
||||
"""If ``data`` is unicode, return urllib.quote_plus(data.encode("utf-8"))
|
||||
otherwise return urllib.quote_plus(data)"""
|
||||
if data is None:
|
||||
return None
|
||||
|
||||
if isinstance(data, unicode):
|
||||
data = data.encode("utf-8")
|
||||
return urllib.quote_plus(data)
|
||||
|
||||
def _strify(s):
|
||||
"""If s is a unicode string, encode it to UTF-8 and return the results,
|
||||
otherwise return str(s), or None if s is None"""
|
||||
if s is None:
|
||||
return None
|
||||
if isinstance(s, unicode):
|
||||
return s.encode("utf-8")
|
||||
return str(s)
|
||||
|
||||
class MultipartParam(object):
|
||||
"""Represents a single parameter in a multipart/form-data request
|
||||
|
||||
``name`` is the name of this parameter.
|
||||
|
||||
If ``value`` is set, it must be a string or unicode object to use as the
|
||||
data for this parameter.
|
||||
|
||||
If ``filename`` is set, it is what to say that this parameter's filename
|
||||
is. Note that this does not have to be the actual filename any local file.
|
||||
|
||||
If ``filetype`` is set, it is used as the Content-Type for this parameter.
|
||||
If unset it defaults to "text/plain; charset=utf8"
|
||||
|
||||
If ``filesize`` is set, it specifies the length of the file ``fileobj``
|
||||
|
||||
If ``fileobj`` is set, it must be a file-like object that supports
|
||||
.read().
|
||||
|
||||
Both ``value`` and ``fileobj`` must not be set, doing so will
|
||||
raise a ValueError assertion.
|
||||
|
||||
If ``fileobj`` is set, and ``filesize`` is not specified, then
|
||||
the file's size will be determined first by stat'ing ``fileobj``'s
|
||||
file descriptor, and if that fails, by seeking to the end of the file,
|
||||
recording the current position as the size, and then by seeking back to the
|
||||
beginning of the file.
|
||||
|
||||
``cb`` is a callable which will be called from iter_encode with (self,
|
||||
current, total), representing the current parameter, current amount
|
||||
transferred, and the total size.
|
||||
"""
|
||||
def __init__(self, name, value=None, filename=None, filetype=None,
|
||||
filesize=None, fileobj=None, cb=None):
|
||||
self.name = Header(name).encode()
|
||||
self.value = _strify(value)
|
||||
if filename is None:
|
||||
self.filename = None
|
||||
else:
|
||||
if isinstance(filename, unicode):
|
||||
# Encode with XML entities
|
||||
self.filename = filename.encode("ascii", "xmlcharrefreplace")
|
||||
else:
|
||||
self.filename = str(filename)
|
||||
self.filename = self.filename.encode("string_escape").\
|
||||
replace('"', '\\"')
|
||||
self.filetype = _strify(filetype)
|
||||
|
||||
self.filesize = filesize
|
||||
self.fileobj = fileobj
|
||||
self.cb = cb
|
||||
|
||||
if self.value is not None and self.fileobj is not None:
|
||||
raise ValueError("Only one of value or fileobj may be specified")
|
||||
|
||||
if fileobj is not None and filesize is None:
|
||||
# Try and determine the file size
|
||||
try:
|
||||
self.filesize = os.fstat(fileobj.fileno()).st_size
|
||||
except (OSError, AttributeError):
|
||||
try:
|
||||
fileobj.seek(0, 2)
|
||||
self.filesize = fileobj.tell()
|
||||
fileobj.seek(0)
|
||||
except:
|
||||
raise ValueError("Could not determine filesize")
|
||||
|
||||
def __cmp__(self, other):
|
||||
attrs = ['name', 'value', 'filename', 'filetype', 'filesize', 'fileobj']
|
||||
myattrs = [getattr(self, a) for a in attrs]
|
||||
oattrs = [getattr(other, a) for a in attrs]
|
||||
return cmp(myattrs, oattrs)
|
||||
|
||||
def reset(self):
|
||||
if self.fileobj is not None:
|
||||
self.fileobj.seek(0)
|
||||
elif self.value is None:
|
||||
raise ValueError("Don't know how to reset this parameter")
|
||||
|
||||
@classmethod
|
||||
def from_file(cls, paramname, filename):
|
||||
"""Returns a new MultipartParam object constructed from the local
|
||||
file at ``filename``.
|
||||
|
||||
``filesize`` is determined by os.path.getsize(``filename``)
|
||||
|
||||
``filetype`` is determined by mimetypes.guess_type(``filename``)[0]
|
||||
|
||||
``filename`` is set to os.path.basename(``filename``)
|
||||
"""
|
||||
|
||||
return cls(paramname, filename=os.path.basename(filename),
|
||||
filetype=mimetypes.guess_type(filename)[0],
|
||||
filesize=os.path.getsize(filename),
|
||||
fileobj=open(filename, "rb"))
|
||||
|
||||
@classmethod
|
||||
def from_params(cls, params):
|
||||
"""Returns a list of MultipartParam objects from a sequence of
|
||||
name, value pairs, MultipartParam instances,
|
||||
or from a mapping of names to values
|
||||
|
||||
The values may be strings or file objects, or MultipartParam objects.
|
||||
MultipartParam object names must match the given names in the
|
||||
name,value pairs or mapping, if applicable."""
|
||||
if hasattr(params, 'items'):
|
||||
params = params.items()
|
||||
|
||||
retval = []
|
||||
for item in params:
|
||||
if isinstance(item, cls):
|
||||
retval.append(item)
|
||||
continue
|
||||
name, value = item
|
||||
if isinstance(value, cls):
|
||||
assert value.name == name
|
||||
retval.append(value)
|
||||
continue
|
||||
if hasattr(value, 'read'):
|
||||
# Looks like a file object
|
||||
filename = getattr(value, 'name', None)
|
||||
if filename is not None:
|
||||
filetype = mimetypes.guess_type(filename)[0]
|
||||
else:
|
||||
filetype = None
|
||||
|
||||
retval.append(cls(name=name, filename=filename,
|
||||
filetype=filetype, fileobj=value))
|
||||
else:
|
||||
retval.append(cls(name, value))
|
||||
return retval
|
||||
|
||||
def encode_hdr(self, boundary):
|
||||
"""Returns the header of the encoding of this parameter"""
|
||||
boundary = encode_and_quote(boundary)
|
||||
|
||||
headers = ["--%s" % boundary]
|
||||
|
||||
if self.filename:
|
||||
disposition = 'form-data; name="%s"; filename="%s"' % (self.name,
|
||||
self.filename)
|
||||
else:
|
||||
disposition = 'form-data; name="%s"' % self.name
|
||||
|
||||
headers.append("Content-Disposition: %s" % disposition)
|
||||
|
||||
if self.filetype:
|
||||
filetype = self.filetype
|
||||
else:
|
||||
filetype = "text/plain; charset=utf-8"
|
||||
|
||||
headers.append("Content-Type: %s" % filetype)
|
||||
|
||||
headers.append("")
|
||||
headers.append("")
|
||||
|
||||
return "\r\n".join(headers)
|
||||
|
||||
def encode(self, boundary):
|
||||
"""Returns the string encoding of this parameter"""
|
||||
if self.value is None:
|
||||
value = self.fileobj.read()
|
||||
else:
|
||||
value = self.value
|
||||
|
||||
if re.search("^--%s$" % re.escape(boundary), value, re.M):
|
||||
raise ValueError("boundary found in encoded string")
|
||||
|
||||
return "%s%s\r\n" % (self.encode_hdr(boundary), value)
|
||||
|
||||
def iter_encode(self, boundary, blocksize=4096):
|
||||
"""Yields the encoding of this parameter
|
||||
If self.fileobj is set, then blocks of ``blocksize`` bytes are read and
|
||||
yielded."""
|
||||
total = self.get_size(boundary)
|
||||
current = 0
|
||||
if self.value is not None:
|
||||
block = self.encode(boundary)
|
||||
current += len(block)
|
||||
yield block
|
||||
if self.cb:
|
||||
self.cb(self, current, total)
|
||||
else:
|
||||
block = self.encode_hdr(boundary)
|
||||
current += len(block)
|
||||
yield block
|
||||
if self.cb:
|
||||
self.cb(self, current, total)
|
||||
last_block = ""
|
||||
encoded_boundary = "--%s" % encode_and_quote(boundary)
|
||||
boundary_exp = re.compile("^%s$" % re.escape(encoded_boundary),
|
||||
re.M)
|
||||
while True:
|
||||
block = self.fileobj.read(blocksize)
|
||||
if not block:
|
||||
current += 2
|
||||
yield "\r\n"
|
||||
if self.cb:
|
||||
self.cb(self, current, total)
|
||||
break
|
||||
last_block += block
|
||||
if boundary_exp.search(last_block):
|
||||
raise ValueError("boundary found in file data")
|
||||
last_block = last_block[-len(encoded_boundary)-2:]
|
||||
current += len(block)
|
||||
yield block
|
||||
if self.cb:
|
||||
self.cb(self, current, total)
|
||||
|
||||
def get_size(self, boundary):
|
||||
"""Returns the size in bytes that this param will be when encoded
|
||||
with the given boundary."""
|
||||
if self.filesize is not None:
|
||||
valuesize = self.filesize
|
||||
else:
|
||||
valuesize = len(self.value)
|
||||
|
||||
return len(self.encode_hdr(boundary)) + 2 + valuesize
|
||||
|
||||
def encode_string(boundary, name, value):
|
||||
"""Returns ``name`` and ``value`` encoded as a multipart/form-data
|
||||
variable. ``boundary`` is the boundary string used throughout
|
||||
a single request to separate variables."""
|
||||
|
||||
return MultipartParam(name, value).encode(boundary)
|
||||
|
||||
def encode_file_header(boundary, paramname, filesize, filename=None,
|
||||
filetype=None):
|
||||
"""Returns the leading data for a multipart/form-data field that contains
|
||||
file data.
|
||||
|
||||
``boundary`` is the boundary string used throughout a single request to
|
||||
separate variables.
|
||||
|
||||
``paramname`` is the name of the variable in this request.
|
||||
|
||||
``filesize`` is the size of the file data.
|
||||
|
||||
``filename`` if specified is the filename to give to this field. This
|
||||
field is only useful to the server for determining the original filename.
|
||||
|
||||
``filetype`` if specified is the MIME type of this file.
|
||||
|
||||
The actual file data should be sent after this header has been sent.
|
||||
"""
|
||||
|
||||
return MultipartParam(paramname, filesize=filesize, filename=filename,
|
||||
filetype=filetype).encode_hdr(boundary)
|
||||
|
||||
def get_body_size(params, boundary):
|
||||
"""Returns the number of bytes that the multipart/form-data encoding
|
||||
of ``params`` will be."""
|
||||
size = sum(p.get_size(boundary) for p in MultipartParam.from_params(params))
|
||||
return size + len(boundary) + 6
|
||||
|
||||
def get_headers(params, boundary):
|
||||
"""Returns a dictionary with Content-Type and Content-Length headers
|
||||
for the multipart/form-data encoding of ``params``."""
|
||||
headers = {}
|
||||
boundary = urllib.quote_plus(boundary)
|
||||
headers['Content-Type'] = "multipart/form-data; boundary=%s" % boundary
|
||||
headers['Content-Length'] = str(get_body_size(params, boundary))
|
||||
return headers
|
||||
|
||||
class multipart_yielder:
|
||||
def __init__(self, params, boundary, cb):
|
||||
self.params = params
|
||||
self.boundary = boundary
|
||||
self.cb = cb
|
||||
|
||||
self.i = 0
|
||||
self.p = None
|
||||
self.param_iter = None
|
||||
self.current = 0
|
||||
self.total = get_body_size(params, boundary)
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def next(self):
|
||||
"""generator function to yield multipart/form-data representation
|
||||
of parameters"""
|
||||
if self.param_iter is not None:
|
||||
try:
|
||||
block = self.param_iter.next()
|
||||
self.current += len(block)
|
||||
if self.cb:
|
||||
self.cb(self.p, self.current, self.total)
|
||||
return block
|
||||
except StopIteration:
|
||||
self.p = None
|
||||
self.param_iter = None
|
||||
|
||||
if self.i is None:
|
||||
raise StopIteration
|
||||
elif self.i >= len(self.params):
|
||||
self.param_iter = None
|
||||
self.p = None
|
||||
self.i = None
|
||||
block = "--%s--\r\n" % self.boundary
|
||||
self.current += len(block)
|
||||
if self.cb:
|
||||
self.cb(self.p, self.current, self.total)
|
||||
return block
|
||||
|
||||
self.p = self.params[self.i]
|
||||
self.param_iter = self.p.iter_encode(self.boundary)
|
||||
self.i += 1
|
||||
return self.next()
|
||||
|
||||
def reset(self):
|
||||
self.i = 0
|
||||
self.current = 0
|
||||
for param in self.params:
|
||||
param.reset()
|
||||
|
||||
def multipart_encode(params, boundary=None, cb=None):
|
||||
"""Encode ``params`` as multipart/form-data.
|
||||
|
||||
``params`` should be a sequence of (name, value) pairs or MultipartParam
|
||||
objects, or a mapping of names to values.
|
||||
Values are either strings parameter values, or file-like objects to use as
|
||||
the parameter value. The file-like objects must support .read() and either
|
||||
.fileno() or both .seek() and .tell().
|
||||
|
||||
If ``boundary`` is set, then it as used as the MIME boundary. Otherwise
|
||||
a randomly generated boundary will be used. In either case, if the
|
||||
boundary string appears in the parameter values a ValueError will be
|
||||
raised.
|
||||
|
||||
If ``cb`` is set, it should be a callback which will get called as blocks
|
||||
of data are encoded. It will be called with (param, current, total),
|
||||
indicating the current parameter being encoded, the current amount encoded,
|
||||
and the total amount to encode.
|
||||
|
||||
Returns a tuple of `datagen`, `headers`, where `datagen` is a
|
||||
generator that will yield blocks of data that make up the encoded
|
||||
parameters, and `headers` is a dictionary with the assoicated
|
||||
Content-Type and Content-Length headers.
|
||||
|
||||
Examples:
|
||||
|
||||
>>> datagen, headers = multipart_encode( [("key", "value1"), ("key", "value2")] )
|
||||
>>> s = "".join(datagen)
|
||||
>>> assert "value2" in s and "value1" in s
|
||||
|
||||
>>> p = MultipartParam("key", "value2")
|
||||
>>> datagen, headers = multipart_encode( [("key", "value1"), p] )
|
||||
>>> s = "".join(datagen)
|
||||
>>> assert "value2" in s and "value1" in s
|
||||
|
||||
>>> datagen, headers = multipart_encode( {"key": "value1"} )
|
||||
>>> s = "".join(datagen)
|
||||
>>> assert "value2" not in s and "value1" in s
|
||||
|
||||
"""
|
||||
if boundary is None:
|
||||
boundary = gen_boundary()
|
||||
else:
|
||||
boundary = urllib.quote_plus(boundary)
|
||||
|
||||
headers = get_headers(params, boundary)
|
||||
params = MultipartParam.from_params(params)
|
||||
|
||||
return multipart_yielder(params, boundary, cb), headers
|
||||
@@ -1,197 +0,0 @@
|
||||
"""Streaming HTTP uploads module.
|
||||
|
||||
This module extends the standard httplib and urllib2 objects so that
|
||||
iterable objects can be used in the body of HTTP requests.
|
||||
|
||||
In most cases all one should have to do is call :func:`register_openers()`
|
||||
to register the new streaming http handlers which will take priority over
|
||||
the default handlers, and then you can use iterable objects in the body
|
||||
of HTTP requests.
|
||||
|
||||
**N.B.** You must specify a Content-Length header if using an iterable object
|
||||
since there is no way to determine in advance the total size that will be
|
||||
yielded, and there is no way to reset an interator.
|
||||
|
||||
Example usage:
|
||||
|
||||
>>> from StringIO import StringIO
|
||||
>>> import urllib2, poster.streaminghttp
|
||||
|
||||
>>> opener = poster.streaminghttp.register_openers()
|
||||
|
||||
>>> s = "Test file data"
|
||||
>>> f = StringIO(s)
|
||||
|
||||
>>> req = urllib2.Request("http://localhost:5000", f,
|
||||
... {'Content-Length': str(len(s))})
|
||||
"""
|
||||
|
||||
import httplib, urllib2, socket
|
||||
from httplib import NotConnected
|
||||
|
||||
__all__ = ['StreamingHTTPConnection', 'StreamingHTTPRedirectHandler',
|
||||
'StreamingHTTPHandler', 'register_openers']
|
||||
|
||||
if hasattr(httplib, 'HTTPS'):
|
||||
__all__.extend(['StreamingHTTPSHandler', 'StreamingHTTPSConnection'])
|
||||
|
||||
class _StreamingHTTPMixin:
|
||||
"""Mixin class for HTTP and HTTPS connections that implements a streaming
|
||||
send method."""
|
||||
def send(self, value):
|
||||
"""Send ``value`` to the server.
|
||||
|
||||
``value`` can be a string object, a file-like object that supports
|
||||
a .read() method, or an iterable object that supports a .next()
|
||||
method.
|
||||
"""
|
||||
# Based on python 2.6's httplib.HTTPConnection.send()
|
||||
if self.sock is None:
|
||||
if self.auto_open:
|
||||
self.connect()
|
||||
else:
|
||||
raise NotConnected()
|
||||
|
||||
# send the data to the server. if we get a broken pipe, then close
|
||||
# the socket. we want to reconnect when somebody tries to send again.
|
||||
#
|
||||
# NOTE: we DO propagate the error, though, because we cannot simply
|
||||
# ignore the error... the caller will know if they can retry.
|
||||
if self.debuglevel > 0:
|
||||
print "send:", repr(value)
|
||||
try:
|
||||
blocksize = 8192
|
||||
if hasattr(value, 'read') :
|
||||
if hasattr(value, 'seek'):
|
||||
value.seek(0)
|
||||
if self.debuglevel > 0:
|
||||
print "sendIng a read()able"
|
||||
data = value.read(blocksize)
|
||||
while data:
|
||||
self.sock.sendall(data)
|
||||
data = value.read(blocksize)
|
||||
elif hasattr(value, 'next'):
|
||||
if hasattr(value, 'reset'):
|
||||
value.reset()
|
||||
if self.debuglevel > 0:
|
||||
print "sendIng an iterable"
|
||||
for data in value:
|
||||
self.sock.sendall(data)
|
||||
else:
|
||||
self.sock.sendall(value)
|
||||
except socket.error, v:
|
||||
if v[0] == 32: # Broken pipe
|
||||
self.close()
|
||||
raise
|
||||
|
||||
class StreamingHTTPConnection(_StreamingHTTPMixin, httplib.HTTPConnection):
|
||||
"""Subclass of `httplib.HTTPConnection` that overrides the `send()` method
|
||||
to support iterable body objects"""
|
||||
|
||||
class StreamingHTTPRedirectHandler(urllib2.HTTPRedirectHandler):
|
||||
"""Subclass of `urllib2.HTTPRedirectHandler` that overrides the
|
||||
`redirect_request` method to properly handle redirected POST requests
|
||||
|
||||
This class is required because python 2.5's HTTPRedirectHandler does
|
||||
not remove the Content-Type or Content-Length headers when requesting
|
||||
the new resource, but the body of the original request is not preserved.
|
||||
"""
|
||||
|
||||
handler_order = urllib2.HTTPRedirectHandler.handler_order - 1
|
||||
|
||||
# From python2.6 urllib2's HTTPRedirectHandler
|
||||
def redirect_request(self, req, fp, code, msg, headers, newurl):
|
||||
"""Return a Request or None in response to a redirect.
|
||||
|
||||
This is called by the http_error_30x methods when a
|
||||
redirection response is received. If a redirection should
|
||||
take place, return a new Request to allow http_error_30x to
|
||||
perform the redirect. Otherwise, raise HTTPError if no-one
|
||||
else should try to handle this url. Return None if you can't
|
||||
but another Handler might.
|
||||
"""
|
||||
m = req.get_method()
|
||||
if (code in (301, 302, 303, 307) and m in ("GET", "HEAD")
|
||||
or code in (301, 302, 303) and m == "POST"):
|
||||
# Strictly (according to RFC 2616), 301 or 302 in response
|
||||
# to a POST MUST NOT cause a redirection without confirmation
|
||||
# from the user (of urllib2, in this case). In practice,
|
||||
# essentially all clients do redirect in this case, so we
|
||||
# do the same.
|
||||
# be conciliant with URIs containing a space
|
||||
newurl = newurl.replace(' ', '%20')
|
||||
newheaders = dict((k, v) for k, v in req.headers.items()
|
||||
if k.lower() not in (
|
||||
"content-length", "content-type")
|
||||
)
|
||||
return urllib2.Request(newurl,
|
||||
headers=newheaders,
|
||||
origin_req_host=req.get_origin_req_host(),
|
||||
unverifiable=True)
|
||||
else:
|
||||
raise urllib2.HTTPError(req.get_full_url(), code, msg, headers, fp)
|
||||
|
||||
class StreamingHTTPHandler(urllib2.HTTPHandler):
|
||||
"""Subclass of `urllib2.HTTPHandler` that uses
|
||||
StreamingHTTPConnection as its http connection class."""
|
||||
|
||||
handler_order = urllib2.HTTPHandler.handler_order - 1
|
||||
|
||||
def http_open(self, req):
|
||||
"""Open a StreamingHTTPConnection for the given request"""
|
||||
return self.do_open(StreamingHTTPConnection, req)
|
||||
|
||||
def http_request(self, req):
|
||||
"""Handle a HTTP request. Make sure that Content-Length is specified
|
||||
if we're using an interable value"""
|
||||
# Make sure that if we're using an iterable object as the request
|
||||
# body, that we've also specified Content-Length
|
||||
if req.has_data():
|
||||
data = req.get_data()
|
||||
if hasattr(data, 'read') or hasattr(data, 'next'):
|
||||
if not req.has_header('Content-length'):
|
||||
raise ValueError(
|
||||
"No Content-Length specified for iterable body")
|
||||
return urllib2.HTTPHandler.do_request_(self, req)
|
||||
|
||||
if hasattr(httplib, 'HTTPS'):
|
||||
class StreamingHTTPSConnection(_StreamingHTTPMixin,
|
||||
httplib.HTTPSConnection):
|
||||
"""Subclass of `httplib.HTTSConnection` that overrides the `send()`
|
||||
method to support iterable body objects"""
|
||||
|
||||
class StreamingHTTPSHandler(urllib2.HTTPSHandler):
|
||||
"""Subclass of `urllib2.HTTPSHandler` that uses
|
||||
StreamingHTTPSConnection as its http connection class."""
|
||||
|
||||
handler_order = urllib2.HTTPSHandler.handler_order - 1
|
||||
|
||||
def https_open(self, req):
|
||||
return self.do_open(StreamingHTTPSConnection, req)
|
||||
|
||||
def https_request(self, req):
|
||||
# Make sure that if we're using an iterable object as the request
|
||||
# body, that we've also specified Content-Length
|
||||
if req.has_data():
|
||||
data = req.get_data()
|
||||
if hasattr(data, 'read') or hasattr(data, 'next'):
|
||||
if not req.has_header('Content-length'):
|
||||
raise ValueError(
|
||||
"No Content-Length specified for iterable body")
|
||||
return urllib2.HTTPSHandler.do_request_(self, req)
|
||||
|
||||
|
||||
def register_openers():
|
||||
"""Register the streaming http handlers in the global urllib2 default
|
||||
opener object.
|
||||
|
||||
Returns the created OpenerDirector object."""
|
||||
handlers = [StreamingHTTPHandler, StreamingHTTPRedirectHandler]
|
||||
if hasattr(httplib, "HTTPS"):
|
||||
handlers.append(StreamingHTTPSHandler)
|
||||
|
||||
opener = urllib2.build_opener(*handlers)
|
||||
|
||||
urllib2.install_opener(opener)
|
||||
|
||||
return opener
|
||||
737
requests/sessions.py
Normal file
737
requests/sessions.py
Normal file
@@ -0,0 +1,737 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.session
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
This module provides a Session object to manage and persist settings across
|
||||
requests (cookies, auth, proxies).
|
||||
"""
|
||||
import os
|
||||
import platform
|
||||
import time
|
||||
from collections import Mapping
|
||||
from datetime import timedelta
|
||||
|
||||
from .auth import _basic_auth_str
|
||||
from .compat import cookielib, is_py3, OrderedDict, urljoin, urlparse
|
||||
from .cookies import (
|
||||
cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar, merge_cookies)
|
||||
from .models import Request, PreparedRequest, DEFAULT_REDIRECT_LIMIT
|
||||
from .hooks import default_hooks, dispatch_hook
|
||||
from ._internal_utils import to_native_string
|
||||
from .utils import to_key_val_list, default_headers
|
||||
from .exceptions import (
|
||||
TooManyRedirects, InvalidSchema, ChunkedEncodingError, ContentDecodingError)
|
||||
|
||||
from .structures import CaseInsensitiveDict
|
||||
from .adapters import HTTPAdapter
|
||||
|
||||
from .utils import (
|
||||
requote_uri, get_environ_proxies, get_netrc_auth, should_bypass_proxies,
|
||||
get_auth_from_url, rewind_body
|
||||
)
|
||||
|
||||
from .status_codes import codes
|
||||
|
||||
# formerly defined here, reexposed here for backward compatibility
|
||||
from .models import REDIRECT_STATI
|
||||
|
||||
# Preferred clock, based on which one is more accurate on a given system.
|
||||
if platform.system() == 'Windows':
|
||||
try: # Python 3.3+
|
||||
preferred_clock = time.perf_counter
|
||||
except AttributeError: # Earlier than Python 3.
|
||||
preferred_clock = time.clock
|
||||
else:
|
||||
preferred_clock = time.time
|
||||
|
||||
|
||||
def merge_setting(request_setting, session_setting, dict_class=OrderedDict):
|
||||
"""Determines appropriate setting for a given request, taking into account
|
||||
the explicit setting on that request, and the setting in the session. If a
|
||||
setting is a dictionary, they will be merged together using `dict_class`
|
||||
"""
|
||||
|
||||
if session_setting is None:
|
||||
return request_setting
|
||||
|
||||
if request_setting is None:
|
||||
return session_setting
|
||||
|
||||
# Bypass if not a dictionary (e.g. verify)
|
||||
if not (
|
||||
isinstance(session_setting, Mapping) and
|
||||
isinstance(request_setting, Mapping)
|
||||
):
|
||||
return request_setting
|
||||
|
||||
merged_setting = dict_class(to_key_val_list(session_setting))
|
||||
merged_setting.update(to_key_val_list(request_setting))
|
||||
|
||||
# Remove keys that are set to None. Extract keys first to avoid altering
|
||||
# the dictionary during iteration.
|
||||
none_keys = [k for (k, v) in merged_setting.items() if v is None]
|
||||
for key in none_keys:
|
||||
del merged_setting[key]
|
||||
|
||||
return merged_setting
|
||||
|
||||
|
||||
def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict):
|
||||
"""Properly merges both requests and session hooks.
|
||||
|
||||
This is necessary because when request_hooks == {'response': []}, the
|
||||
merge breaks Session hooks entirely.
|
||||
"""
|
||||
if session_hooks is None or session_hooks.get('response') == []:
|
||||
return request_hooks
|
||||
|
||||
if request_hooks is None or request_hooks.get('response') == []:
|
||||
return session_hooks
|
||||
|
||||
return merge_setting(request_hooks, session_hooks, dict_class)
|
||||
|
||||
|
||||
class SessionRedirectMixin(object):
|
||||
|
||||
def get_redirect_target(self, resp):
|
||||
"""Receives a Response. Returns a redirect URI or ``None``"""
|
||||
# Due to the nature of how requests processes redirects this method will
|
||||
# be called at least once upon the original response and at least twice
|
||||
# on each subsequent redirect response (if any).
|
||||
# If a custom mixin is used to handle this logic, it may be advantageous
|
||||
# to cache the redirect location onto the response object as a private
|
||||
# attribute.
|
||||
if resp.is_redirect:
|
||||
location = resp.headers['location']
|
||||
# Currently the underlying http module on py3 decode headers
|
||||
# in latin1, but empirical evidence suggests that latin1 is very
|
||||
# rarely used with non-ASCII characters in HTTP headers.
|
||||
# It is more likely to get UTF8 header rather than latin1.
|
||||
# This causes incorrect handling of UTF8 encoded location headers.
|
||||
# To solve this, we re-encode the location in latin1.
|
||||
if is_py3:
|
||||
location = location.encode('latin1')
|
||||
return to_native_string(location, 'utf8')
|
||||
return None
|
||||
|
||||
def resolve_redirects(self, resp, req, stream=False, timeout=None,
|
||||
verify=True, cert=None, proxies=None, yield_requests=False, **adapter_kwargs):
|
||||
"""Receives a Response. Returns a generator of Responses or Requests."""
|
||||
|
||||
hist = [] # keep track of history
|
||||
|
||||
url = self.get_redirect_target(resp)
|
||||
while url:
|
||||
prepared_request = req.copy()
|
||||
|
||||
# Update history and keep track of redirects.
|
||||
# resp.history must ignore the original request in this loop
|
||||
hist.append(resp)
|
||||
resp.history = hist[1:]
|
||||
|
||||
try:
|
||||
resp.content # Consume socket so it can be released
|
||||
except (ChunkedEncodingError, ContentDecodingError, RuntimeError):
|
||||
resp.raw.read(decode_content=False)
|
||||
|
||||
if len(resp.history) >= self.max_redirects:
|
||||
raise TooManyRedirects('Exceeded %s redirects.' % self.max_redirects, response=resp)
|
||||
|
||||
# Release the connection back into the pool.
|
||||
resp.close()
|
||||
|
||||
# Handle redirection without scheme (see: RFC 1808 Section 4)
|
||||
if url.startswith('//'):
|
||||
parsed_rurl = urlparse(resp.url)
|
||||
url = '%s:%s' % (to_native_string(parsed_rurl.scheme), url)
|
||||
|
||||
# The scheme should be lower case...
|
||||
parsed = urlparse(url)
|
||||
url = parsed.geturl()
|
||||
|
||||
# Facilitate relative 'location' headers, as allowed by RFC 7231.
|
||||
# (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')
|
||||
# Compliant with RFC3986, we percent encode the url.
|
||||
if not parsed.netloc:
|
||||
url = urljoin(resp.url, requote_uri(url))
|
||||
else:
|
||||
url = requote_uri(url)
|
||||
|
||||
prepared_request.url = to_native_string(url)
|
||||
|
||||
self.rebuild_method(prepared_request, resp)
|
||||
|
||||
# https://github.com/requests/requests/issues/1084
|
||||
if resp.status_code not in (codes.temporary_redirect, codes.permanent_redirect):
|
||||
# https://github.com/requests/requests/issues/3490
|
||||
purged_headers = ('Content-Length', 'Content-Type', 'Transfer-Encoding')
|
||||
for header in purged_headers:
|
||||
prepared_request.headers.pop(header, None)
|
||||
prepared_request.body = None
|
||||
|
||||
headers = prepared_request.headers
|
||||
try:
|
||||
del headers['Cookie']
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
# Extract any cookies sent on the response to the cookiejar
|
||||
# in the new request. Because we've mutated our copied prepared
|
||||
# request, use the old one that we haven't yet touched.
|
||||
extract_cookies_to_jar(prepared_request._cookies, req, resp.raw)
|
||||
merge_cookies(prepared_request._cookies, self.cookies)
|
||||
prepared_request.prepare_cookies(prepared_request._cookies)
|
||||
|
||||
# Rebuild auth and proxy information.
|
||||
proxies = self.rebuild_proxies(prepared_request, proxies)
|
||||
self.rebuild_auth(prepared_request, resp)
|
||||
|
||||
# A failed tell() sets `_body_position` to `object()`. This non-None
|
||||
# value ensures `rewindable` will be True, allowing us to raise an
|
||||
# UnrewindableBodyError, instead of hanging the connection.
|
||||
rewindable = (
|
||||
prepared_request._body_position is not None and
|
||||
('Content-Length' in headers or 'Transfer-Encoding' in headers)
|
||||
)
|
||||
|
||||
# Attempt to rewind consumed file-like object.
|
||||
if rewindable:
|
||||
rewind_body(prepared_request)
|
||||
|
||||
# Override the original request.
|
||||
req = prepared_request
|
||||
|
||||
if yield_requests:
|
||||
yield req
|
||||
else:
|
||||
|
||||
resp = self.send(
|
||||
req,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
verify=verify,
|
||||
cert=cert,
|
||||
proxies=proxies,
|
||||
allow_redirects=False,
|
||||
**adapter_kwargs
|
||||
)
|
||||
|
||||
extract_cookies_to_jar(self.cookies, prepared_request, resp.raw)
|
||||
|
||||
# extract redirect url, if any, for the next loop
|
||||
url = self.get_redirect_target(resp)
|
||||
yield resp
|
||||
|
||||
def rebuild_auth(self, prepared_request, response):
|
||||
"""When being redirected we may want to strip authentication from the
|
||||
request to avoid leaking credentials. This method intelligently removes
|
||||
and reapplies authentication where possible to avoid credential loss.
|
||||
"""
|
||||
headers = prepared_request.headers
|
||||
url = prepared_request.url
|
||||
|
||||
if 'Authorization' in headers:
|
||||
# If we get redirected to a new host, we should strip out any
|
||||
# authentication headers.
|
||||
original_parsed = urlparse(response.request.url)
|
||||
redirect_parsed = urlparse(url)
|
||||
|
||||
if (original_parsed.hostname != redirect_parsed.hostname):
|
||||
del headers['Authorization']
|
||||
|
||||
# .netrc might have more auth for us on our new host.
|
||||
new_auth = get_netrc_auth(url) if self.trust_env else None
|
||||
if new_auth is not None:
|
||||
prepared_request.prepare_auth(new_auth)
|
||||
|
||||
return
|
||||
|
||||
def rebuild_proxies(self, prepared_request, proxies):
|
||||
"""This method re-evaluates the proxy configuration by considering the
|
||||
environment variables. If we are redirected to a URL covered by
|
||||
NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
|
||||
proxy keys for this URL (in case they were stripped by a previous
|
||||
redirect).
|
||||
|
||||
This method also replaces the Proxy-Authorization header where
|
||||
necessary.
|
||||
|
||||
:rtype: dict
|
||||
"""
|
||||
proxies = proxies if proxies is not None else {}
|
||||
headers = prepared_request.headers
|
||||
url = prepared_request.url
|
||||
scheme = urlparse(url).scheme
|
||||
new_proxies = proxies.copy()
|
||||
no_proxy = proxies.get('no_proxy')
|
||||
|
||||
bypass_proxy = should_bypass_proxies(url, no_proxy=no_proxy)
|
||||
if self.trust_env and not bypass_proxy:
|
||||
environ_proxies = get_environ_proxies(url, no_proxy=no_proxy)
|
||||
|
||||
proxy = environ_proxies.get(scheme, environ_proxies.get('all'))
|
||||
|
||||
if proxy:
|
||||
new_proxies.setdefault(scheme, proxy)
|
||||
|
||||
if 'Proxy-Authorization' in headers:
|
||||
del headers['Proxy-Authorization']
|
||||
|
||||
try:
|
||||
username, password = get_auth_from_url(new_proxies[scheme])
|
||||
except KeyError:
|
||||
username, password = None, None
|
||||
|
||||
if username and password:
|
||||
headers['Proxy-Authorization'] = _basic_auth_str(username, password)
|
||||
|
||||
return new_proxies
|
||||
|
||||
def rebuild_method(self, prepared_request, response):
|
||||
"""When being redirected we may want to change the method of the request
|
||||
based on certain specs or browser behavior.
|
||||
"""
|
||||
method = prepared_request.method
|
||||
|
||||
# http://tools.ietf.org/html/rfc7231#section-6.4.4
|
||||
if response.status_code == codes.see_other and method != 'HEAD':
|
||||
method = 'GET'
|
||||
|
||||
# Do what the browsers do, despite standards...
|
||||
# First, turn 302s into GETs.
|
||||
if response.status_code == codes.found and method != 'HEAD':
|
||||
method = 'GET'
|
||||
|
||||
# Second, if a POST is responded to with a 301, turn it into a GET.
|
||||
# This bizarre behaviour is explained in Issue 1704.
|
||||
if response.status_code == codes.moved and method == 'POST':
|
||||
method = 'GET'
|
||||
|
||||
prepared_request.method = method
|
||||
|
||||
|
||||
class Session(SessionRedirectMixin):
|
||||
"""A Requests session.
|
||||
|
||||
Provides cookie persistence, connection-pooling, and configuration.
|
||||
|
||||
Basic Usage::
|
||||
|
||||
>>> import requests
|
||||
>>> s = requests.Session()
|
||||
>>> s.get('http://httpbin.org/get')
|
||||
<Response [200]>
|
||||
|
||||
Or as a context manager::
|
||||
|
||||
>>> with requests.Session() as s:
|
||||
>>> s.get('http://httpbin.org/get')
|
||||
<Response [200]>
|
||||
"""
|
||||
|
||||
__attrs__ = [
|
||||
'headers', 'cookies', 'auth', 'proxies', 'hooks', 'params', 'verify',
|
||||
'cert', 'prefetch', 'adapters', 'stream', 'trust_env',
|
||||
'max_redirects',
|
||||
]
|
||||
|
||||
def __init__(self):
|
||||
|
||||
#: A case-insensitive dictionary of headers to be sent on each
|
||||
#: :class:`Request <Request>` sent from this
|
||||
#: :class:`Session <Session>`.
|
||||
self.headers = default_headers()
|
||||
|
||||
#: Default Authentication tuple or object to attach to
|
||||
#: :class:`Request <Request>`.
|
||||
self.auth = None
|
||||
|
||||
#: Dictionary mapping protocol or protocol and host to the URL of the proxy
|
||||
#: (e.g. {'http': 'foo.bar:3128', 'http://host.name': 'foo.bar:4012'}) to
|
||||
#: be used on each :class:`Request <Request>`.
|
||||
self.proxies = {}
|
||||
|
||||
#: Event-handling hooks.
|
||||
self.hooks = default_hooks()
|
||||
|
||||
#: Dictionary of querystring data to attach to each
|
||||
#: :class:`Request <Request>`. The dictionary values may be lists for
|
||||
#: representing multivalued query parameters.
|
||||
self.params = {}
|
||||
|
||||
#: Stream response content default.
|
||||
self.stream = False
|
||||
|
||||
#: SSL Verification default.
|
||||
self.verify = True
|
||||
|
||||
#: SSL client certificate default, if String, path to ssl client
|
||||
#: cert file (.pem). If Tuple, ('cert', 'key') pair.
|
||||
self.cert = None
|
||||
|
||||
#: Maximum number of redirects allowed. If the request exceeds this
|
||||
#: limit, a :class:`TooManyRedirects` exception is raised.
|
||||
#: This defaults to requests.models.DEFAULT_REDIRECT_LIMIT, which is
|
||||
#: 30.
|
||||
self.max_redirects = DEFAULT_REDIRECT_LIMIT
|
||||
|
||||
#: Trust environment settings for proxy configuration, default
|
||||
#: authentication and similar.
|
||||
self.trust_env = True
|
||||
|
||||
#: A CookieJar containing all currently outstanding cookies set on this
|
||||
#: session. By default it is a
|
||||
#: :class:`RequestsCookieJar <requests.cookies.RequestsCookieJar>`, but
|
||||
#: may be any other ``cookielib.CookieJar`` compatible object.
|
||||
self.cookies = cookiejar_from_dict({})
|
||||
|
||||
# Default connection adapters.
|
||||
self.adapters = OrderedDict()
|
||||
self.mount('https://', HTTPAdapter())
|
||||
self.mount('http://', HTTPAdapter())
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *args):
|
||||
self.close()
|
||||
|
||||
def prepare_request(self, request):
|
||||
"""Constructs a :class:`PreparedRequest <PreparedRequest>` for
|
||||
transmission and returns it. The :class:`PreparedRequest` has settings
|
||||
merged from the :class:`Request <Request>` instance and those of the
|
||||
:class:`Session`.
|
||||
|
||||
:param request: :class:`Request` instance to prepare with this
|
||||
session's settings.
|
||||
:rtype: requests.PreparedRequest
|
||||
"""
|
||||
cookies = request.cookies or {}
|
||||
|
||||
# Bootstrap CookieJar.
|
||||
if not isinstance(cookies, cookielib.CookieJar):
|
||||
cookies = cookiejar_from_dict(cookies)
|
||||
|
||||
# Merge with session cookies
|
||||
merged_cookies = merge_cookies(
|
||||
merge_cookies(RequestsCookieJar(), self.cookies), cookies)
|
||||
|
||||
# Set environment's basic authentication if not explicitly set.
|
||||
auth = request.auth
|
||||
if self.trust_env and not auth and not self.auth:
|
||||
auth = get_netrc_auth(request.url)
|
||||
|
||||
p = PreparedRequest()
|
||||
p.prepare(
|
||||
method=request.method.upper(),
|
||||
url=request.url,
|
||||
files=request.files,
|
||||
data=request.data,
|
||||
json=request.json,
|
||||
headers=merge_setting(request.headers, self.headers, dict_class=CaseInsensitiveDict),
|
||||
params=merge_setting(request.params, self.params),
|
||||
auth=merge_setting(auth, self.auth),
|
||||
cookies=merged_cookies,
|
||||
hooks=merge_hooks(request.hooks, self.hooks),
|
||||
)
|
||||
return p
|
||||
|
||||
def request(self, method, url,
|
||||
params=None, data=None, headers=None, cookies=None, files=None,
|
||||
auth=None, timeout=None, allow_redirects=True, proxies=None,
|
||||
hooks=None, stream=None, verify=None, cert=None, json=None):
|
||||
"""Constructs a :class:`Request <Request>`, prepares it and sends it.
|
||||
Returns :class:`Response <Response>` object.
|
||||
|
||||
:param method: method for the new :class:`Request` object.
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param params: (optional) Dictionary or bytes to be sent in the query
|
||||
string for the :class:`Request`.
|
||||
:param data: (optional) Dictionary, bytes, or file-like object to send
|
||||
in the body of the :class:`Request`.
|
||||
:param json: (optional) json to send in the body of the
|
||||
:class:`Request`.
|
||||
:param headers: (optional) Dictionary of HTTP Headers to send with the
|
||||
:class:`Request`.
|
||||
:param cookies: (optional) Dict or CookieJar object to send with the
|
||||
:class:`Request`.
|
||||
:param files: (optional) Dictionary of ``'filename': file-like-objects``
|
||||
for multipart encoding upload.
|
||||
:param auth: (optional) Auth tuple or callable to enable
|
||||
Basic/Digest/Custom HTTP Auth.
|
||||
:param timeout: (optional) How long to wait for the server to send
|
||||
data before giving up, as a float, or a :ref:`(connect timeout,
|
||||
read timeout) <timeouts>` tuple.
|
||||
:type timeout: float or tuple
|
||||
:param allow_redirects: (optional) Set to True by default.
|
||||
:type allow_redirects: bool
|
||||
:param proxies: (optional) Dictionary mapping protocol or protocol and
|
||||
hostname to the URL of the proxy.
|
||||
:param stream: (optional) whether to immediately download the response
|
||||
content. Defaults to ``False``.
|
||||
:param verify: (optional) Either a boolean, in which case it controls whether we verify
|
||||
the server's TLS certificate, or a string, in which case it must be a path
|
||||
to a CA bundle to use. Defaults to ``True``.
|
||||
:param cert: (optional) if String, path to ssl client cert file (.pem).
|
||||
If Tuple, ('cert', 'key') pair.
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
# Create the Request.
|
||||
req = Request(
|
||||
method=method.upper(),
|
||||
url=url,
|
||||
headers=headers,
|
||||
files=files,
|
||||
data=data or {},
|
||||
json=json,
|
||||
params=params or {},
|
||||
auth=auth,
|
||||
cookies=cookies,
|
||||
hooks=hooks,
|
||||
)
|
||||
prep = self.prepare_request(req)
|
||||
|
||||
proxies = proxies or {}
|
||||
|
||||
settings = self.merge_environment_settings(
|
||||
prep.url, proxies, stream, verify, cert
|
||||
)
|
||||
|
||||
# Send the request.
|
||||
send_kwargs = {
|
||||
'timeout': timeout,
|
||||
'allow_redirects': allow_redirects,
|
||||
}
|
||||
send_kwargs.update(settings)
|
||||
resp = self.send(prep, **send_kwargs)
|
||||
|
||||
return resp
|
||||
|
||||
def get(self, url, **kwargs):
|
||||
r"""Sends a GET request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
kwargs.setdefault('allow_redirects', True)
|
||||
return self.request('GET', url, **kwargs)
|
||||
|
||||
def options(self, url, **kwargs):
|
||||
r"""Sends a OPTIONS request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
kwargs.setdefault('allow_redirects', True)
|
||||
return self.request('OPTIONS', url, **kwargs)
|
||||
|
||||
def head(self, url, **kwargs):
|
||||
r"""Sends a HEAD request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
kwargs.setdefault('allow_redirects', False)
|
||||
return self.request('HEAD', url, **kwargs)
|
||||
|
||||
def post(self, url, data=None, json=None, **kwargs):
|
||||
r"""Sends a POST request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
|
||||
:param json: (optional) json to send in the body of the :class:`Request`.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
return self.request('POST', url, data=data, json=json, **kwargs)
|
||||
|
||||
def put(self, url, data=None, **kwargs):
|
||||
r"""Sends a PUT request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
return self.request('PUT', url, data=data, **kwargs)
|
||||
|
||||
def patch(self, url, data=None, **kwargs):
|
||||
r"""Sends a PATCH request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
return self.request('PATCH', url, data=data, **kwargs)
|
||||
|
||||
def delete(self, url, **kwargs):
|
||||
r"""Sends a DELETE request. Returns :class:`Response` object.
|
||||
|
||||
:param url: URL for the new :class:`Request` object.
|
||||
:param \*\*kwargs: Optional arguments that ``request`` takes.
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
|
||||
return self.request('DELETE', url, **kwargs)
|
||||
|
||||
def send(self, request, **kwargs):
|
||||
"""Send a given PreparedRequest.
|
||||
|
||||
:rtype: requests.Response
|
||||
"""
|
||||
# Set defaults that the hooks can utilize to ensure they always have
|
||||
# the correct parameters to reproduce the previous request.
|
||||
kwargs.setdefault('stream', self.stream)
|
||||
kwargs.setdefault('verify', self.verify)
|
||||
kwargs.setdefault('cert', self.cert)
|
||||
kwargs.setdefault('proxies', self.proxies)
|
||||
|
||||
# It's possible that users might accidentally send a Request object.
|
||||
# Guard against that specific failure case.
|
||||
if isinstance(request, Request):
|
||||
raise ValueError('You can only send PreparedRequests.')
|
||||
|
||||
# Set up variables needed for resolve_redirects and dispatching of hooks
|
||||
allow_redirects = kwargs.pop('allow_redirects', True)
|
||||
stream = kwargs.get('stream')
|
||||
hooks = request.hooks
|
||||
|
||||
# Get the appropriate adapter to use
|
||||
adapter = self.get_adapter(url=request.url)
|
||||
|
||||
# Start time (approximately) of the request
|
||||
start = preferred_clock()
|
||||
|
||||
# Send the request
|
||||
r = adapter.send(request, **kwargs)
|
||||
|
||||
# Total elapsed time of the request (approximately)
|
||||
elapsed = preferred_clock() - start
|
||||
r.elapsed = timedelta(seconds=elapsed)
|
||||
|
||||
# Response manipulation hooks
|
||||
r = dispatch_hook('response', hooks, r, **kwargs)
|
||||
|
||||
# Persist cookies
|
||||
if r.history:
|
||||
|
||||
# If the hooks create history then we want those cookies too
|
||||
for resp in r.history:
|
||||
extract_cookies_to_jar(self.cookies, resp.request, resp.raw)
|
||||
|
||||
extract_cookies_to_jar(self.cookies, request, r.raw)
|
||||
|
||||
# Redirect resolving generator.
|
||||
gen = self.resolve_redirects(r, request, **kwargs)
|
||||
|
||||
# Resolve redirects if allowed.
|
||||
history = [resp for resp in gen] if allow_redirects else []
|
||||
|
||||
# Shuffle things around if there's history.
|
||||
if history:
|
||||
# Insert the first (original) request at the start
|
||||
history.insert(0, r)
|
||||
# Get the last request made
|
||||
r = history.pop()
|
||||
r.history = history
|
||||
|
||||
# If redirects aren't being followed, store the response on the Request for Response.next().
|
||||
if not allow_redirects:
|
||||
try:
|
||||
r._next = next(self.resolve_redirects(r, request, yield_requests=True, **kwargs))
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
if not stream:
|
||||
r.content
|
||||
|
||||
return r
|
||||
|
||||
def merge_environment_settings(self, url, proxies, stream, verify, cert):
|
||||
"""
|
||||
Check the environment and merge it with some settings.
|
||||
|
||||
:rtype: dict
|
||||
"""
|
||||
# Gather clues from the surrounding environment.
|
||||
if self.trust_env:
|
||||
# Set environment's proxies.
|
||||
no_proxy = proxies.get('no_proxy') if proxies is not None else None
|
||||
env_proxies = get_environ_proxies(url, no_proxy=no_proxy)
|
||||
for (k, v) in env_proxies.items():
|
||||
proxies.setdefault(k, v)
|
||||
|
||||
# Look for requests environment configuration and be compatible
|
||||
# with cURL.
|
||||
if verify is True or verify is None:
|
||||
verify = (os.environ.get('REQUESTS_CA_BUNDLE') or
|
||||
os.environ.get('CURL_CA_BUNDLE'))
|
||||
|
||||
# Merge all the kwargs.
|
||||
proxies = merge_setting(proxies, self.proxies)
|
||||
stream = merge_setting(stream, self.stream)
|
||||
verify = merge_setting(verify, self.verify)
|
||||
cert = merge_setting(cert, self.cert)
|
||||
|
||||
return {'verify': verify, 'proxies': proxies, 'stream': stream,
|
||||
'cert': cert}
|
||||
|
||||
def get_adapter(self, url):
|
||||
"""
|
||||
Returns the appropriate connection adapter for the given URL.
|
||||
|
||||
:rtype: requests.adapters.BaseAdapter
|
||||
"""
|
||||
for (prefix, adapter) in self.adapters.items():
|
||||
|
||||
if url.lower().startswith(prefix):
|
||||
return adapter
|
||||
|
||||
# Nothing matches :-/
|
||||
raise InvalidSchema("No connection adapters were found for '%s'" % url)
|
||||
|
||||
def close(self):
|
||||
"""Closes all adapters and as such the session"""
|
||||
for v in self.adapters.values():
|
||||
v.close()
|
||||
|
||||
def mount(self, prefix, adapter):
|
||||
"""Registers a connection adapter to a prefix.
|
||||
|
||||
Adapters are sorted in descending order by prefix length.
|
||||
"""
|
||||
self.adapters[prefix] = adapter
|
||||
keys_to_move = [k for k in self.adapters if len(k) < len(prefix)]
|
||||
|
||||
for key in keys_to_move:
|
||||
self.adapters[key] = self.adapters.pop(key)
|
||||
|
||||
def __getstate__(self):
|
||||
state = dict((attr, getattr(self, attr, None)) for attr in self.__attrs__)
|
||||
return state
|
||||
|
||||
def __setstate__(self, state):
|
||||
for attr, value in state.items():
|
||||
setattr(self, attr, value)
|
||||
|
||||
|
||||
def session():
|
||||
"""
|
||||
Returns a :class:`Session` for context-management.
|
||||
|
||||
:rtype: Session
|
||||
"""
|
||||
|
||||
return Session()
|
||||
91
requests/status_codes.py
Normal file
91
requests/status_codes.py
Normal file
@@ -0,0 +1,91 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from .structures import LookupDict
|
||||
|
||||
_codes = {
|
||||
|
||||
# Informational.
|
||||
100: ('continue',),
|
||||
101: ('switching_protocols',),
|
||||
102: ('processing',),
|
||||
103: ('checkpoint',),
|
||||
122: ('uri_too_long', 'request_uri_too_long'),
|
||||
200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/', '✓'),
|
||||
201: ('created',),
|
||||
202: ('accepted',),
|
||||
203: ('non_authoritative_info', 'non_authoritative_information'),
|
||||
204: ('no_content',),
|
||||
205: ('reset_content', 'reset'),
|
||||
206: ('partial_content', 'partial'),
|
||||
207: ('multi_status', 'multiple_status', 'multi_stati', 'multiple_stati'),
|
||||
208: ('already_reported',),
|
||||
226: ('im_used',),
|
||||
|
||||
# Redirection.
|
||||
300: ('multiple_choices',),
|
||||
301: ('moved_permanently', 'moved', '\\o-'),
|
||||
302: ('found',),
|
||||
303: ('see_other', 'other'),
|
||||
304: ('not_modified',),
|
||||
305: ('use_proxy',),
|
||||
306: ('switch_proxy',),
|
||||
307: ('temporary_redirect', 'temporary_moved', 'temporary'),
|
||||
308: ('permanent_redirect',
|
||||
'resume_incomplete', 'resume',), # These 2 to be removed in 3.0
|
||||
|
||||
# Client Error.
|
||||
400: ('bad_request', 'bad'),
|
||||
401: ('unauthorized',),
|
||||
402: ('payment_required', 'payment'),
|
||||
403: ('forbidden',),
|
||||
404: ('not_found', '-o-'),
|
||||
405: ('method_not_allowed', 'not_allowed'),
|
||||
406: ('not_acceptable',),
|
||||
407: ('proxy_authentication_required', 'proxy_auth', 'proxy_authentication'),
|
||||
408: ('request_timeout', 'timeout'),
|
||||
409: ('conflict',),
|
||||
410: ('gone',),
|
||||
411: ('length_required',),
|
||||
412: ('precondition_failed', 'precondition'),
|
||||
413: ('request_entity_too_large',),
|
||||
414: ('request_uri_too_large',),
|
||||
415: ('unsupported_media_type', 'unsupported_media', 'media_type'),
|
||||
416: ('requested_range_not_satisfiable', 'requested_range', 'range_not_satisfiable'),
|
||||
417: ('expectation_failed',),
|
||||
418: ('im_a_teapot', 'teapot', 'i_am_a_teapot'),
|
||||
421: ('misdirected_request',),
|
||||
422: ('unprocessable_entity', 'unprocessable'),
|
||||
423: ('locked',),
|
||||
424: ('failed_dependency', 'dependency'),
|
||||
425: ('unordered_collection', 'unordered'),
|
||||
426: ('upgrade_required', 'upgrade'),
|
||||
428: ('precondition_required', 'precondition'),
|
||||
429: ('too_many_requests', 'too_many'),
|
||||
431: ('header_fields_too_large', 'fields_too_large'),
|
||||
444: ('no_response', 'none'),
|
||||
449: ('retry_with', 'retry'),
|
||||
450: ('blocked_by_windows_parental_controls', 'parental_controls'),
|
||||
451: ('unavailable_for_legal_reasons', 'legal_reasons'),
|
||||
499: ('client_closed_request',),
|
||||
|
||||
# Server Error.
|
||||
500: ('internal_server_error', 'server_error', '/o\\', '✗'),
|
||||
501: ('not_implemented',),
|
||||
502: ('bad_gateway',),
|
||||
503: ('service_unavailable', 'unavailable'),
|
||||
504: ('gateway_timeout',),
|
||||
505: ('http_version_not_supported', 'http_version'),
|
||||
506: ('variant_also_negotiates',),
|
||||
507: ('insufficient_storage',),
|
||||
509: ('bandwidth_limit_exceeded', 'bandwidth'),
|
||||
510: ('not_extended',),
|
||||
511: ('network_authentication_required', 'network_auth', 'network_authentication'),
|
||||
}
|
||||
|
||||
codes = LookupDict(name='status_codes')
|
||||
|
||||
for code, titles in _codes.items():
|
||||
for title in titles:
|
||||
setattr(codes, title, code)
|
||||
if not title.startswith(('\\', '/')):
|
||||
setattr(codes, title.upper(), code)
|
||||
105
requests/structures.py
Normal file
105
requests/structures.py
Normal file
@@ -0,0 +1,105 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.structures
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Data structures that power Requests.
|
||||
"""
|
||||
|
||||
import collections
|
||||
|
||||
from .compat import OrderedDict
|
||||
|
||||
|
||||
class CaseInsensitiveDict(collections.MutableMapping):
|
||||
"""A case-insensitive ``dict``-like object.
|
||||
|
||||
Implements all methods and operations of
|
||||
``collections.MutableMapping`` as well as dict's ``copy``. Also
|
||||
provides ``lower_items``.
|
||||
|
||||
All keys are expected to be strings. The structure remembers the
|
||||
case of the last key to be set, and ``iter(instance)``,
|
||||
``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()``
|
||||
will contain case-sensitive keys. However, querying and contains
|
||||
testing is case insensitive::
|
||||
|
||||
cid = CaseInsensitiveDict()
|
||||
cid['Accept'] = 'application/json'
|
||||
cid['aCCEPT'] == 'application/json' # True
|
||||
list(cid) == ['Accept'] # True
|
||||
|
||||
For example, ``headers['content-encoding']`` will return the
|
||||
value of a ``'Content-Encoding'`` response header, regardless
|
||||
of how the header name was originally stored.
|
||||
|
||||
If the constructor, ``.update``, or equality comparison
|
||||
operations are given keys that have equal ``.lower()``s, the
|
||||
behavior is undefined.
|
||||
"""
|
||||
|
||||
def __init__(self, data=None, **kwargs):
|
||||
self._store = OrderedDict()
|
||||
if data is None:
|
||||
data = {}
|
||||
self.update(data, **kwargs)
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
# Use the lowercased key for lookups, but store the actual
|
||||
# key alongside the value.
|
||||
self._store[key.lower()] = (key, value)
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self._store[key.lower()][1]
|
||||
|
||||
def __delitem__(self, key):
|
||||
del self._store[key.lower()]
|
||||
|
||||
def __iter__(self):
|
||||
return (casedkey for casedkey, mappedvalue in self._store.values())
|
||||
|
||||
def __len__(self):
|
||||
return len(self._store)
|
||||
|
||||
def lower_items(self):
|
||||
"""Like iteritems(), but with all lowercase keys."""
|
||||
return (
|
||||
(lowerkey, keyval[1])
|
||||
for (lowerkey, keyval)
|
||||
in self._store.items()
|
||||
)
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, collections.Mapping):
|
||||
other = CaseInsensitiveDict(other)
|
||||
else:
|
||||
return NotImplemented
|
||||
# Compare insensitively
|
||||
return dict(self.lower_items()) == dict(other.lower_items())
|
||||
|
||||
# Copy is required
|
||||
def copy(self):
|
||||
return CaseInsensitiveDict(self._store.values())
|
||||
|
||||
def __repr__(self):
|
||||
return str(dict(self.items()))
|
||||
|
||||
|
||||
class LookupDict(dict):
|
||||
"""Dictionary lookup object."""
|
||||
|
||||
def __init__(self, name=None):
|
||||
self.name = name
|
||||
super(LookupDict, self).__init__()
|
||||
|
||||
def __repr__(self):
|
||||
return '<lookup \'%s\'>' % (self.name)
|
||||
|
||||
def __getitem__(self, key):
|
||||
# We allow fall-through here, so values default to None
|
||||
|
||||
return self.__dict__.get(key, None)
|
||||
|
||||
def get(self, key, default=None):
|
||||
return self.__dict__.get(key, default)
|
||||
904
requests/utils.py
Normal file
904
requests/utils.py
Normal file
@@ -0,0 +1,904 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
requests.utils
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
This module provides utility functions that are used within Requests
|
||||
that are also useful for external consumption.
|
||||
"""
|
||||
|
||||
import cgi
|
||||
import codecs
|
||||
import collections
|
||||
import contextlib
|
||||
import io
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import socket
|
||||
import struct
|
||||
import warnings
|
||||
|
||||
from .__version__ import __version__
|
||||
from . import certs
|
||||
# to_native_string is unused here, but imported here for backwards compatibility
|
||||
from ._internal_utils import to_native_string
|
||||
from .compat import parse_http_list as _parse_list_header
|
||||
from .compat import (
|
||||
quote, urlparse, bytes, str, OrderedDict, unquote, getproxies,
|
||||
proxy_bypass, urlunparse, basestring, integer_types, is_py3,
|
||||
proxy_bypass_environment, getproxies_environment)
|
||||
from .cookies import cookiejar_from_dict
|
||||
from .structures import CaseInsensitiveDict
|
||||
from .exceptions import (
|
||||
InvalidURL, InvalidHeader, FileModeWarning, UnrewindableBodyError)
|
||||
|
||||
NETRC_FILES = ('.netrc', '_netrc')
|
||||
|
||||
DEFAULT_CA_BUNDLE_PATH = certs.where()
|
||||
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
# provide a proxy_bypass version on Windows without DNS lookups
|
||||
|
||||
def proxy_bypass_registry(host):
|
||||
if is_py3:
|
||||
import winreg
|
||||
else:
|
||||
import _winreg as winreg
|
||||
try:
|
||||
internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
|
||||
r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
|
||||
proxyEnable = winreg.QueryValueEx(internetSettings,
|
||||
'ProxyEnable')[0]
|
||||
proxyOverride = winreg.QueryValueEx(internetSettings,
|
||||
'ProxyOverride')[0]
|
||||
except OSError:
|
||||
return False
|
||||
if not proxyEnable or not proxyOverride:
|
||||
return False
|
||||
|
||||
# make a check value list from the registry entry: replace the
|
||||
# '<local>' string by the localhost entry and the corresponding
|
||||
# canonical entry.
|
||||
proxyOverride = proxyOverride.split(';')
|
||||
# now check if we match one of the registry values.
|
||||
for test in proxyOverride:
|
||||
if test == '<local>':
|
||||
if '.' not in host:
|
||||
return True
|
||||
test = test.replace(".", r"\.") # mask dots
|
||||
test = test.replace("*", r".*") # change glob sequence
|
||||
test = test.replace("?", r".") # change glob char
|
||||
if re.match(test, host, re.I):
|
||||
return True
|
||||
return False
|
||||
|
||||
def proxy_bypass(host): # noqa
|
||||
"""Return True, if the host should be bypassed.
|
||||
|
||||
Checks proxy settings gathered from the environment, if specified,
|
||||
or the registry.
|
||||
"""
|
||||
if getproxies_environment():
|
||||
return proxy_bypass_environment(host)
|
||||
else:
|
||||
return proxy_bypass_registry(host)
|
||||
|
||||
|
||||
def dict_to_sequence(d):
|
||||
"""Returns an internal sequence dictionary update."""
|
||||
|
||||
if hasattr(d, 'items'):
|
||||
d = d.items()
|
||||
|
||||
return d
|
||||
|
||||
|
||||
def super_len(o):
|
||||
total_length = None
|
||||
current_position = 0
|
||||
|
||||
if hasattr(o, '__len__'):
|
||||
total_length = len(o)
|
||||
|
||||
elif hasattr(o, 'len'):
|
||||
total_length = o.len
|
||||
|
||||
elif hasattr(o, 'fileno'):
|
||||
try:
|
||||
fileno = o.fileno()
|
||||
except io.UnsupportedOperation:
|
||||
pass
|
||||
else:
|
||||
total_length = os.fstat(fileno).st_size
|
||||
|
||||
# Having used fstat to determine the file length, we need to
|
||||
# confirm that this file was opened up in binary mode.
|
||||
if 'b' not in o.mode:
|
||||
warnings.warn((
|
||||
"Requests has determined the content-length for this "
|
||||
"request using the binary size of the file: however, the "
|
||||
"file has been opened in text mode (i.e. without the 'b' "
|
||||
"flag in the mode). This may lead to an incorrect "
|
||||
"content-length. In Requests 3.0, support will be removed "
|
||||
"for files in text mode."),
|
||||
FileModeWarning
|
||||
)
|
||||
|
||||
if hasattr(o, 'tell'):
|
||||
try:
|
||||
current_position = o.tell()
|
||||
except (OSError, IOError):
|
||||
# This can happen in some weird situations, such as when the file
|
||||
# is actually a special file descriptor like stdin. In this
|
||||
# instance, we don't know what the length is, so set it to zero and
|
||||
# let requests chunk it instead.
|
||||
if total_length is not None:
|
||||
current_position = total_length
|
||||
else:
|
||||
if hasattr(o, 'seek') and total_length is None:
|
||||
# StringIO and BytesIO have seek but no useable fileno
|
||||
try:
|
||||
# seek to end of file
|
||||
o.seek(0, 2)
|
||||
total_length = o.tell()
|
||||
|
||||
# seek back to current position to support
|
||||
# partially read file-like objects
|
||||
o.seek(current_position or 0)
|
||||
except (OSError, IOError):
|
||||
total_length = 0
|
||||
|
||||
if total_length is None:
|
||||
total_length = 0
|
||||
|
||||
return max(0, total_length - current_position)
|
||||
|
||||
|
||||
def get_netrc_auth(url, raise_errors=False):
|
||||
"""Returns the Requests tuple auth for a given url from netrc."""
|
||||
|
||||
try:
|
||||
from netrc import netrc, NetrcParseError
|
||||
|
||||
netrc_path = None
|
||||
|
||||
for f in NETRC_FILES:
|
||||
try:
|
||||
loc = os.path.expanduser('~/{0}'.format(f))
|
||||
except KeyError:
|
||||
# os.path.expanduser can fail when $HOME is undefined and
|
||||
# getpwuid fails. See http://bugs.python.org/issue20164 &
|
||||
# https://github.com/requests/requests/issues/1846
|
||||
return
|
||||
|
||||
if os.path.exists(loc):
|
||||
netrc_path = loc
|
||||
break
|
||||
|
||||
# Abort early if there isn't one.
|
||||
if netrc_path is None:
|
||||
return
|
||||
|
||||
ri = urlparse(url)
|
||||
|
||||
# Strip port numbers from netloc. This weird `if...encode`` dance is
|
||||
# used for Python 3.2, which doesn't support unicode literals.
|
||||
splitstr = b':'
|
||||
if isinstance(url, str):
|
||||
splitstr = splitstr.decode('ascii')
|
||||
host = ri.netloc.split(splitstr)[0]
|
||||
|
||||
try:
|
||||
_netrc = netrc(netrc_path).authenticators(host)
|
||||
if _netrc:
|
||||
# Return with login / password
|
||||
login_i = (0 if _netrc[0] else 1)
|
||||
return (_netrc[login_i], _netrc[2])
|
||||
except (NetrcParseError, IOError):
|
||||
# If there was a parsing error or a permissions issue reading the file,
|
||||
# we'll just skip netrc auth unless explicitly asked to raise errors.
|
||||
if raise_errors:
|
||||
raise
|
||||
|
||||
# AppEngine hackiness.
|
||||
except (ImportError, AttributeError):
|
||||
pass
|
||||
|
||||
|
||||
def guess_filename(obj):
|
||||
"""Tries to guess the filename of the given object."""
|
||||
name = getattr(obj, 'name', None)
|
||||
if (name and isinstance(name, basestring) and name[0] != '<' and
|
||||
name[-1] != '>'):
|
||||
return os.path.basename(name)
|
||||
|
||||
|
||||
def from_key_val_list(value):
|
||||
"""Take an object and test to see if it can be represented as a
|
||||
dictionary. Unless it can not be represented as such, return an
|
||||
OrderedDict, e.g.,
|
||||
|
||||
::
|
||||
|
||||
>>> from_key_val_list([('key', 'val')])
|
||||
OrderedDict([('key', 'val')])
|
||||
>>> from_key_val_list('string')
|
||||
ValueError: need more than 1 value to unpack
|
||||
>>> from_key_val_list({'key': 'val'})
|
||||
OrderedDict([('key', 'val')])
|
||||
|
||||
:rtype: OrderedDict
|
||||
"""
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
if isinstance(value, (str, bytes, bool, int)):
|
||||
raise ValueError('cannot encode objects that are not 2-tuples')
|
||||
|
||||
return OrderedDict(value)
|
||||
|
||||
|
||||
def to_key_val_list(value):
|
||||
"""Take an object and test to see if it can be represented as a
|
||||
dictionary. If it can be, return a list of tuples, e.g.,
|
||||
|
||||
::
|
||||
|
||||
>>> to_key_val_list([('key', 'val')])
|
||||
[('key', 'val')]
|
||||
>>> to_key_val_list({'key': 'val'})
|
||||
[('key', 'val')]
|
||||
>>> to_key_val_list('string')
|
||||
ValueError: cannot encode objects that are not 2-tuples.
|
||||
|
||||
:rtype: list
|
||||
"""
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
if isinstance(value, (str, bytes, bool, int)):
|
||||
raise ValueError('cannot encode objects that are not 2-tuples')
|
||||
|
||||
if isinstance(value, collections.Mapping):
|
||||
value = value.items()
|
||||
|
||||
return list(value)
|
||||
|
||||
|
||||
# From mitsuhiko/werkzeug (used with permission).
|
||||
def parse_list_header(value):
|
||||
"""Parse lists as described by RFC 2068 Section 2.
|
||||
|
||||
In particular, parse comma-separated lists where the elements of
|
||||
the list may include quoted-strings. A quoted-string could
|
||||
contain a comma. A non-quoted string could have quotes in the
|
||||
middle. Quotes are removed automatically after parsing.
|
||||
|
||||
It basically works like :func:`parse_set_header` just that items
|
||||
may appear multiple times and case sensitivity is preserved.
|
||||
|
||||
The return value is a standard :class:`list`:
|
||||
|
||||
>>> parse_list_header('token, "quoted value"')
|
||||
['token', 'quoted value']
|
||||
|
||||
To create a header from the :class:`list` again, use the
|
||||
:func:`dump_header` function.
|
||||
|
||||
:param value: a string with a list header.
|
||||
:return: :class:`list`
|
||||
:rtype: list
|
||||
"""
|
||||
result = []
|
||||
for item in _parse_list_header(value):
|
||||
if item[:1] == item[-1:] == '"':
|
||||
item = unquote_header_value(item[1:-1])
|
||||
result.append(item)
|
||||
return result
|
||||
|
||||
|
||||
# From mitsuhiko/werkzeug (used with permission).
|
||||
def parse_dict_header(value):
|
||||
"""Parse lists of key, value pairs as described by RFC 2068 Section 2 and
|
||||
convert them into a python dict:
|
||||
|
||||
>>> d = parse_dict_header('foo="is a fish", bar="as well"')
|
||||
>>> type(d) is dict
|
||||
True
|
||||
>>> sorted(d.items())
|
||||
[('bar', 'as well'), ('foo', 'is a fish')]
|
||||
|
||||
If there is no value for a key it will be `None`:
|
||||
|
||||
>>> parse_dict_header('key_without_value')
|
||||
{'key_without_value': None}
|
||||
|
||||
To create a header from the :class:`dict` again, use the
|
||||
:func:`dump_header` function.
|
||||
|
||||
:param value: a string with a dict header.
|
||||
:return: :class:`dict`
|
||||
:rtype: dict
|
||||
"""
|
||||
result = {}
|
||||
for item in _parse_list_header(value):
|
||||
if '=' not in item:
|
||||
result[item] = None
|
||||
continue
|
||||
name, value = item.split('=', 1)
|
||||
if value[:1] == value[-1:] == '"':
|
||||
value = unquote_header_value(value[1:-1])
|
||||
result[name] = value
|
||||
return result
|
||||
|
||||
|
||||
# From mitsuhiko/werkzeug (used with permission).
|
||||
def unquote_header_value(value, is_filename=False):
|
||||
r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
|
||||
This does not use the real unquoting but what browsers are actually
|
||||
using for quoting.
|
||||
|
||||
:param value: the header value to unquote.
|
||||
:rtype: str
|
||||
"""
|
||||
if value and value[0] == value[-1] == '"':
|
||||
# this is not the real unquoting, but fixing this so that the
|
||||
# RFC is met will result in bugs with internet explorer and
|
||||
# probably some other browsers as well. IE for example is
|
||||
# uploading files with "C:\foo\bar.txt" as filename
|
||||
value = value[1:-1]
|
||||
|
||||
# if this is a filename and the starting characters look like
|
||||
# a UNC path, then just return the value without quotes. Using the
|
||||
# replace sequence below on a UNC path has the effect of turning
|
||||
# the leading double slash into a single slash and then
|
||||
# _fix_ie_filename() doesn't work correctly. See #458.
|
||||
if not is_filename or value[:2] != '\\\\':
|
||||
return value.replace('\\\\', '\\').replace('\\"', '"')
|
||||
return value
|
||||
|
||||
|
||||
def dict_from_cookiejar(cj):
|
||||
"""Returns a key/value dictionary from a CookieJar.
|
||||
|
||||
:param cj: CookieJar object to extract cookies from.
|
||||
:rtype: dict
|
||||
"""
|
||||
|
||||
cookie_dict = {}
|
||||
|
||||
for cookie in cj:
|
||||
cookie_dict[cookie.name] = cookie.value
|
||||
|
||||
return cookie_dict
|
||||
|
||||
|
||||
def add_dict_to_cookiejar(cj, cookie_dict):
|
||||
"""Returns a CookieJar from a key/value dictionary.
|
||||
|
||||
:param cj: CookieJar to insert cookies into.
|
||||
:param cookie_dict: Dict of key/values to insert into CookieJar.
|
||||
:rtype: CookieJar
|
||||
"""
|
||||
|
||||
return cookiejar_from_dict(cookie_dict, cj)
|
||||
|
||||
|
||||
def get_encodings_from_content(content):
|
||||
"""Returns encodings from given content string.
|
||||
|
||||
:param content: bytestring to extract encodings from.
|
||||
"""
|
||||
warnings.warn((
|
||||
'In requests 3.0, get_encodings_from_content will be removed. For '
|
||||
'more information, please see the discussion on issue #2266. (This'
|
||||
' warning should only appear once.)'),
|
||||
DeprecationWarning)
|
||||
|
||||
charset_re = re.compile(r'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)
|
||||
pragma_re = re.compile(r'<meta.*?content=["\']*;?charset=(.+?)["\'>]', flags=re.I)
|
||||
xml_re = re.compile(r'^<\?xml.*?encoding=["\']*(.+?)["\'>]')
|
||||
|
||||
return (charset_re.findall(content) +
|
||||
pragma_re.findall(content) +
|
||||
xml_re.findall(content))
|
||||
|
||||
|
||||
def get_encoding_from_headers(headers):
|
||||
"""Returns encodings from given HTTP Header Dict.
|
||||
|
||||
:param headers: dictionary to extract encoding from.
|
||||
:rtype: str
|
||||
"""
|
||||
|
||||
content_type = headers.get('content-type')
|
||||
|
||||
if not content_type:
|
||||
return None
|
||||
|
||||
content_type, params = cgi.parse_header(content_type)
|
||||
|
||||
if 'charset' in params:
|
||||
return params['charset'].strip("'\"")
|
||||
|
||||
if 'text' in content_type:
|
||||
return 'ISO-8859-1'
|
||||
|
||||
|
||||
def stream_decode_response_unicode(iterator, r):
|
||||
"""Stream decodes a iterator."""
|
||||
|
||||
if r.encoding is None:
|
||||
for item in iterator:
|
||||
yield item
|
||||
return
|
||||
|
||||
decoder = codecs.getincrementaldecoder(r.encoding)(errors='replace')
|
||||
for chunk in iterator:
|
||||
rv = decoder.decode(chunk)
|
||||
if rv:
|
||||
yield rv
|
||||
rv = decoder.decode(b'', final=True)
|
||||
if rv:
|
||||
yield rv
|
||||
|
||||
|
||||
def iter_slices(string, slice_length):
|
||||
"""Iterate over slices of a string."""
|
||||
pos = 0
|
||||
if slice_length is None or slice_length <= 0:
|
||||
slice_length = len(string)
|
||||
while pos < len(string):
|
||||
yield string[pos:pos + slice_length]
|
||||
pos += slice_length
|
||||
|
||||
|
||||
def get_unicode_from_response(r):
|
||||
"""Returns the requested content back in unicode.
|
||||
|
||||
:param r: Response object to get unicode content from.
|
||||
|
||||
Tried:
|
||||
|
||||
1. charset from content-type
|
||||
2. fall back and replace all unicode characters
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
warnings.warn((
|
||||
'In requests 3.0, get_unicode_from_response will be removed. For '
|
||||
'more information, please see the discussion on issue #2266. (This'
|
||||
' warning should only appear once.)'),
|
||||
DeprecationWarning)
|
||||
|
||||
tried_encodings = []
|
||||
|
||||
# Try charset from content-type
|
||||
encoding = get_encoding_from_headers(r.headers)
|
||||
|
||||
if encoding:
|
||||
try:
|
||||
return str(r.content, encoding)
|
||||
except UnicodeError:
|
||||
tried_encodings.append(encoding)
|
||||
|
||||
# Fall back:
|
||||
try:
|
||||
return str(r.content, encoding, errors='replace')
|
||||
except TypeError:
|
||||
return r.content
|
||||
|
||||
|
||||
# The unreserved URI characters (RFC 3986)
|
||||
UNRESERVED_SET = frozenset(
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789-._~")
|
||||
|
||||
|
||||
def unquote_unreserved(uri):
|
||||
"""Un-escape any percent-escape sequences in a URI that are unreserved
|
||||
characters. This leaves all reserved, illegal and non-ASCII bytes encoded.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
parts = uri.split('%')
|
||||
for i in range(1, len(parts)):
|
||||
h = parts[i][0:2]
|
||||
if len(h) == 2 and h.isalnum():
|
||||
try:
|
||||
c = chr(int(h, 16))
|
||||
except ValueError:
|
||||
raise InvalidURL("Invalid percent-escape sequence: '%s'" % h)
|
||||
|
||||
if c in UNRESERVED_SET:
|
||||
parts[i] = c + parts[i][2:]
|
||||
else:
|
||||
parts[i] = '%' + parts[i]
|
||||
else:
|
||||
parts[i] = '%' + parts[i]
|
||||
return ''.join(parts)
|
||||
|
||||
|
||||
def requote_uri(uri):
|
||||
"""Re-quote the given URI.
|
||||
|
||||
This function passes the given URI through an unquote/quote cycle to
|
||||
ensure that it is fully and consistently quoted.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
safe_with_percent = "!#$%&'()*+,/:;=?@[]~"
|
||||
safe_without_percent = "!#$&'()*+,/:;=?@[]~"
|
||||
try:
|
||||
# Unquote only the unreserved characters
|
||||
# Then quote only illegal characters (do not quote reserved,
|
||||
# unreserved, or '%')
|
||||
return quote(unquote_unreserved(uri), safe=safe_with_percent)
|
||||
except InvalidURL:
|
||||
# We couldn't unquote the given URI, so let's try quoting it, but
|
||||
# there may be unquoted '%'s in the URI. We need to make sure they're
|
||||
# properly quoted so they do not cause issues elsewhere.
|
||||
return quote(uri, safe=safe_without_percent)
|
||||
|
||||
|
||||
def address_in_network(ip, net):
|
||||
"""This function allows you to check if an IP belongs to a network subnet
|
||||
|
||||
Example: returns True if ip = 192.168.1.1 and net = 192.168.1.0/24
|
||||
returns False if ip = 192.168.1.1 and net = 192.168.100.0/24
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
ipaddr = struct.unpack('=L', socket.inet_aton(ip))[0]
|
||||
netaddr, bits = net.split('/')
|
||||
netmask = struct.unpack('=L', socket.inet_aton(dotted_netmask(int(bits))))[0]
|
||||
network = struct.unpack('=L', socket.inet_aton(netaddr))[0] & netmask
|
||||
return (ipaddr & netmask) == (network & netmask)
|
||||
|
||||
|
||||
def dotted_netmask(mask):
|
||||
"""Converts mask from /xx format to xxx.xxx.xxx.xxx
|
||||
|
||||
Example: if mask is 24 function returns 255.255.255.0
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
bits = 0xffffffff ^ (1 << 32 - mask) - 1
|
||||
return socket.inet_ntoa(struct.pack('>I', bits))
|
||||
|
||||
|
||||
def is_ipv4_address(string_ip):
|
||||
"""
|
||||
:rtype: bool
|
||||
"""
|
||||
try:
|
||||
socket.inet_aton(string_ip)
|
||||
except socket.error:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def is_valid_cidr(string_network):
|
||||
"""
|
||||
Very simple check of the cidr format in no_proxy variable.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
if string_network.count('/') == 1:
|
||||
try:
|
||||
mask = int(string_network.split('/')[1])
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
if mask < 1 or mask > 32:
|
||||
return False
|
||||
|
||||
try:
|
||||
socket.inet_aton(string_network.split('/')[0])
|
||||
except socket.error:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def set_environ(env_name, value):
|
||||
"""Set the environment variable 'env_name' to 'value'
|
||||
|
||||
Save previous value, yield, and then restore the previous value stored in
|
||||
the environment variable 'env_name'.
|
||||
|
||||
If 'value' is None, do nothing"""
|
||||
value_changed = value is not None
|
||||
if value_changed:
|
||||
old_value = os.environ.get(env_name)
|
||||
os.environ[env_name] = value
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
if value_changed:
|
||||
if old_value is None:
|
||||
del os.environ[env_name]
|
||||
else:
|
||||
os.environ[env_name] = old_value
|
||||
|
||||
|
||||
def should_bypass_proxies(url, no_proxy):
|
||||
"""
|
||||
Returns whether we should bypass proxies or not.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
get_proxy = lambda k: os.environ.get(k) or os.environ.get(k.upper())
|
||||
|
||||
# First check whether no_proxy is defined. If it is, check that the URL
|
||||
# we're getting isn't in the no_proxy list.
|
||||
no_proxy_arg = no_proxy
|
||||
if no_proxy is None:
|
||||
no_proxy = get_proxy('no_proxy')
|
||||
netloc = urlparse(url).netloc
|
||||
|
||||
if no_proxy:
|
||||
# We need to check whether we match here. We need to see if we match
|
||||
# the end of the netloc, both with and without the port.
|
||||
no_proxy = (
|
||||
host for host in no_proxy.replace(' ', '').split(',') if host
|
||||
)
|
||||
|
||||
ip = netloc.split(':')[0]
|
||||
if is_ipv4_address(ip):
|
||||
for proxy_ip in no_proxy:
|
||||
if is_valid_cidr(proxy_ip):
|
||||
if address_in_network(ip, proxy_ip):
|
||||
return True
|
||||
elif ip == proxy_ip:
|
||||
# If no_proxy ip was defined in plain IP notation instead of cidr notation &
|
||||
# matches the IP of the index
|
||||
return True
|
||||
else:
|
||||
for host in no_proxy:
|
||||
if netloc.endswith(host) or netloc.split(':')[0].endswith(host):
|
||||
# The URL does match something in no_proxy, so we don't want
|
||||
# to apply the proxies on this URL.
|
||||
return True
|
||||
|
||||
# If the system proxy settings indicate that this URL should be bypassed,
|
||||
# don't proxy.
|
||||
# The proxy_bypass function is incredibly buggy on OS X in early versions
|
||||
# of Python 2.6, so allow this call to fail. Only catch the specific
|
||||
# exceptions we've seen, though: this call failing in other ways can reveal
|
||||
# legitimate problems.
|
||||
with set_environ('no_proxy', no_proxy_arg):
|
||||
try:
|
||||
bypass = proxy_bypass(netloc)
|
||||
except (TypeError, socket.gaierror):
|
||||
bypass = False
|
||||
|
||||
if bypass:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def get_environ_proxies(url, no_proxy=None):
|
||||
"""
|
||||
Return a dict of environment proxies.
|
||||
|
||||
:rtype: dict
|
||||
"""
|
||||
if should_bypass_proxies(url, no_proxy=no_proxy):
|
||||
return {}
|
||||
else:
|
||||
return getproxies()
|
||||
|
||||
|
||||
def select_proxy(url, proxies):
|
||||
"""Select a proxy for the url, if applicable.
|
||||
|
||||
:param url: The url being for the request
|
||||
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
|
||||
"""
|
||||
proxies = proxies or {}
|
||||
urlparts = urlparse(url)
|
||||
if urlparts.hostname is None:
|
||||
return proxies.get(urlparts.scheme, proxies.get('all'))
|
||||
|
||||
proxy_keys = [
|
||||
urlparts.scheme + '://' + urlparts.hostname,
|
||||
urlparts.scheme,
|
||||
'all://' + urlparts.hostname,
|
||||
'all',
|
||||
]
|
||||
proxy = None
|
||||
for proxy_key in proxy_keys:
|
||||
if proxy_key in proxies:
|
||||
proxy = proxies[proxy_key]
|
||||
break
|
||||
|
||||
return proxy
|
||||
|
||||
|
||||
def default_user_agent(name="python-requests"):
|
||||
"""
|
||||
Return a string representing the default user agent.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
return '%s/%s' % (name, __version__)
|
||||
|
||||
|
||||
def default_headers():
|
||||
"""
|
||||
:rtype: requests.structures.CaseInsensitiveDict
|
||||
"""
|
||||
return CaseInsensitiveDict({
|
||||
'User-Agent': default_user_agent(),
|
||||
'Accept-Encoding': ', '.join(('gzip', 'deflate')),
|
||||
'Accept': '*/*',
|
||||
'Connection': 'keep-alive',
|
||||
})
|
||||
|
||||
|
||||
def parse_header_links(value):
|
||||
"""Return a dict of parsed link headers proxies.
|
||||
|
||||
i.e. Link: <http:/.../front.jpeg>; rel=front; type="image/jpeg",<http://.../back.jpeg>; rel=back;type="image/jpeg"
|
||||
|
||||
:rtype: list
|
||||
"""
|
||||
|
||||
links = []
|
||||
|
||||
replace_chars = ' \'"'
|
||||
|
||||
for val in re.split(', *<', value):
|
||||
try:
|
||||
url, params = val.split(';', 1)
|
||||
except ValueError:
|
||||
url, params = val, ''
|
||||
|
||||
link = {'url': url.strip('<> \'"')}
|
||||
|
||||
for param in params.split(';'):
|
||||
try:
|
||||
key, value = param.split('=')
|
||||
except ValueError:
|
||||
break
|
||||
|
||||
link[key.strip(replace_chars)] = value.strip(replace_chars)
|
||||
|
||||
links.append(link)
|
||||
|
||||
return links
|
||||
|
||||
|
||||
# Null bytes; no need to recreate these on each call to guess_json_utf
|
||||
_null = '\x00'.encode('ascii') # encoding to ASCII for Python 3
|
||||
_null2 = _null * 2
|
||||
_null3 = _null * 3
|
||||
|
||||
|
||||
def guess_json_utf(data):
|
||||
"""
|
||||
:rtype: str
|
||||
"""
|
||||
# JSON always starts with two ASCII characters, so detection is as
|
||||
# easy as counting the nulls and from their location and count
|
||||
# determine the encoding. Also detect a BOM, if present.
|
||||
sample = data[:4]
|
||||
if sample in (codecs.BOM_UTF32_LE, codecs.BOM_UTF32_BE):
|
||||
return 'utf-32' # BOM included
|
||||
if sample[:3] == codecs.BOM_UTF8:
|
||||
return 'utf-8-sig' # BOM included, MS style (discouraged)
|
||||
if sample[:2] in (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE):
|
||||
return 'utf-16' # BOM included
|
||||
nullcount = sample.count(_null)
|
||||
if nullcount == 0:
|
||||
return 'utf-8'
|
||||
if nullcount == 2:
|
||||
if sample[::2] == _null2: # 1st and 3rd are null
|
||||
return 'utf-16-be'
|
||||
if sample[1::2] == _null2: # 2nd and 4th are null
|
||||
return 'utf-16-le'
|
||||
# Did not detect 2 valid UTF-16 ascii-range characters
|
||||
if nullcount == 3:
|
||||
if sample[:3] == _null3:
|
||||
return 'utf-32-be'
|
||||
if sample[1:] == _null3:
|
||||
return 'utf-32-le'
|
||||
# Did not detect a valid UTF-32 ascii-range character
|
||||
return None
|
||||
|
||||
|
||||
def prepend_scheme_if_needed(url, new_scheme):
|
||||
"""Given a URL that may or may not have a scheme, prepend the given scheme.
|
||||
Does not replace a present scheme with the one provided as an argument.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
scheme, netloc, path, params, query, fragment = urlparse(url, new_scheme)
|
||||
|
||||
# urlparse is a finicky beast, and sometimes decides that there isn't a
|
||||
# netloc present. Assume that it's being over-cautious, and switch netloc
|
||||
# and path if urlparse decided there was no netloc.
|
||||
if not netloc:
|
||||
netloc, path = path, netloc
|
||||
|
||||
return urlunparse((scheme, netloc, path, params, query, fragment))
|
||||
|
||||
|
||||
def get_auth_from_url(url):
|
||||
"""Given a url with authentication components, extract them into a tuple of
|
||||
username,password.
|
||||
|
||||
:rtype: (str,str)
|
||||
"""
|
||||
parsed = urlparse(url)
|
||||
|
||||
try:
|
||||
auth = (unquote(parsed.username), unquote(parsed.password))
|
||||
except (AttributeError, TypeError):
|
||||
auth = ('', '')
|
||||
|
||||
return auth
|
||||
|
||||
|
||||
# Moved outside of function to avoid recompile every call
|
||||
_CLEAN_HEADER_REGEX_BYTE = re.compile(b'^\\S[^\\r\\n]*$|^$')
|
||||
_CLEAN_HEADER_REGEX_STR = re.compile(r'^\S[^\r\n]*$|^$')
|
||||
|
||||
|
||||
def check_header_validity(header):
|
||||
"""Verifies that header value is a string which doesn't contain
|
||||
leading whitespace or return characters. This prevents unintended
|
||||
header injection.
|
||||
|
||||
:param header: tuple, in the format (name, value).
|
||||
"""
|
||||
name, value = header
|
||||
|
||||
if isinstance(value, bytes):
|
||||
pat = _CLEAN_HEADER_REGEX_BYTE
|
||||
else:
|
||||
pat = _CLEAN_HEADER_REGEX_STR
|
||||
try:
|
||||
if not pat.match(value):
|
||||
raise InvalidHeader("Invalid return character or leading space in header: %s" % name)
|
||||
except TypeError:
|
||||
raise InvalidHeader("Value for header {%s: %s} must be of type str or "
|
||||
"bytes, not %s" % (name, value, type(value)))
|
||||
|
||||
|
||||
def urldefragauth(url):
|
||||
"""
|
||||
Given a url remove the fragment and the authentication part.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
scheme, netloc, path, params, query, fragment = urlparse(url)
|
||||
|
||||
# see func:`prepend_scheme_if_needed`
|
||||
if not netloc:
|
||||
netloc, path = path, netloc
|
||||
|
||||
netloc = netloc.rsplit('@', 1)[-1]
|
||||
|
||||
return urlunparse((scheme, netloc, path, params, query, ''))
|
||||
|
||||
|
||||
def rewind_body(prepared_request):
|
||||
"""Move file pointer back to its recorded starting position
|
||||
so it can be read again on redirect.
|
||||
"""
|
||||
body_seek = getattr(prepared_request.body, 'seek', None)
|
||||
if body_seek is not None and isinstance(prepared_request._body_position, integer_types):
|
||||
try:
|
||||
body_seek(prepared_request._body_position)
|
||||
except (IOError, OSError):
|
||||
raise UnrewindableBodyError("An error occurred when rewinding request "
|
||||
"body for redirect.")
|
||||
else:
|
||||
raise UnrewindableBodyError("Unable to rewind request body for redirect.")
|
||||
16
requirements.txt
Normal file
16
requirements.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
-e .[socks]
|
||||
pytest>=2.8.0
|
||||
codecov
|
||||
pytest-httpbin==0.0.7
|
||||
pytest-mock
|
||||
pytest-cov
|
||||
pytest-xdist
|
||||
alabaster
|
||||
readme_renderer
|
||||
Sphinx<=1.5.5
|
||||
PySocks
|
||||
setuptools>=18.5
|
||||
docutils
|
||||
flake8
|
||||
tox
|
||||
detox
|
||||
125
setup.py
Normal file → Executable file
125
setup.py
Normal file → Executable file
@@ -1,51 +1,100 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
from distutils.core import setup
|
||||
from codecs import open
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
|
||||
if sys.argv[-1] == "publish":
|
||||
os.system("python setup.py sdist upload")
|
||||
sys.exit()
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
if sys.argv[-1] == "test":
|
||||
os.system("python test_requests.py")
|
||||
sys.exit()
|
||||
|
||||
required = []
|
||||
class PyTest(TestCommand):
|
||||
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
|
||||
|
||||
# if python > 2.6, require simplejson
|
||||
def initialize_options(self):
|
||||
TestCommand.initialize_options(self)
|
||||
try:
|
||||
from multiprocessing import cpu_count
|
||||
self.pytest_args = ['-n', str(cpu_count()), '--boxed']
|
||||
except (ImportError, NotImplementedError):
|
||||
self.pytest_args = ['-n', '1', '--boxed']
|
||||
|
||||
def finalize_options(self):
|
||||
TestCommand.finalize_options(self)
|
||||
self.test_args = []
|
||||
self.test_suite = True
|
||||
|
||||
def run_tests(self):
|
||||
import pytest
|
||||
|
||||
errno = pytest.main(self.pytest_args)
|
||||
sys.exit(errno)
|
||||
|
||||
# 'setup.py publish' shortcut.
|
||||
if sys.argv[-1] == 'publish':
|
||||
os.system('python setup.py sdist bdist_wheel')
|
||||
os.system('twine upload dist/*')
|
||||
sys.exit()
|
||||
|
||||
packages = ['requests']
|
||||
|
||||
requires = [
|
||||
'chardet>=3.0.2,<3.1.0',
|
||||
'idna>=2.5,<2.7',
|
||||
'urllib3>=1.21.1,<1.23',
|
||||
'certifi>=2017.4.17'
|
||||
|
||||
]
|
||||
test_requirements = ['pytest-httpbin==0.0.7', 'pytest-cov', 'pytest-mock', 'pytest-xdist', 'PySocks>=1.5.6, !=1.5.7', 'pytest>=2.8.0']
|
||||
|
||||
about = {}
|
||||
with open(os.path.join(here, 'requests', '__version__.py'), 'r', 'utf-8') as f:
|
||||
exec(f.read(), about)
|
||||
|
||||
with open('README.rst', 'r', 'utf-8') as f:
|
||||
readme = f.read()
|
||||
with open('HISTORY.rst', 'r', 'utf-8') as f:
|
||||
history = f.read()
|
||||
|
||||
setup(
|
||||
name='requests',
|
||||
version='0.2.3',
|
||||
description='Awesome Python HTTP Library that\'s actually usable.',
|
||||
long_description=open('README.rst').read() + '\n\n' +
|
||||
open('HISTORY.rst').read(),
|
||||
author='Kenneth Reitz',
|
||||
author_email='me@kennethreitz.com',
|
||||
url='https://github.com/kennethreitz/requests',
|
||||
packages= [
|
||||
'requests',
|
||||
'requests.packages',
|
||||
'requests.packages.poster'
|
||||
],
|
||||
install_requires=required,
|
||||
license='ISC',
|
||||
classifiers=(
|
||||
# 'Development Status :: 5 - Production/Stable',
|
||||
'Intended Audience :: Developers',
|
||||
'Natural Language :: English',
|
||||
'License :: OSI Approved :: ISC License (ISCL)',
|
||||
'Programming Language :: Python',
|
||||
# 'Programming Language :: Python :: 2.5',
|
||||
name=about['__title__'],
|
||||
version=about['__version__'],
|
||||
description=about['__description__'],
|
||||
long_description=readme + '\n\n' + history,
|
||||
author=about['__author__'],
|
||||
author_email=about['__author_email__'],
|
||||
url=about['__url__'],
|
||||
packages=packages,
|
||||
package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},
|
||||
package_dir={'requests': 'requests'},
|
||||
include_package_data=True,
|
||||
install_requires=requires,
|
||||
license=about['__license__'],
|
||||
zip_safe=False,
|
||||
classifiers=(
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Intended Audience :: Developers',
|
||||
'Natural Language :: English',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2.6',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
# 'Programming Language :: Python :: 3.0',
|
||||
# 'Programming Language :: Python :: 3.1',
|
||||
),
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: Implementation :: CPython',
|
||||
'Programming Language :: Python :: Implementation :: PyPy'
|
||||
),
|
||||
cmdclass={'test': PyTest},
|
||||
tests_require=test_requirements,
|
||||
extras_require={
|
||||
'security': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'],
|
||||
'socks': ['PySocks>=1.5.6, !=1.5.7'],
|
||||
'socks:sys_platform == "win32" and (python_version == "2.7" or python_version == "2.6")': ['win_inet_pton'],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import unittest
|
||||
from cStringIO import StringIO
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
class RequestsTestSuite(unittest.TestCase):
|
||||
"""Requests test cases."""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
"""Teardown."""
|
||||
pass
|
||||
|
||||
def test_invalid_url(self):
|
||||
self.assertRaises(ValueError, requests.get, 'hiwpefhipowhefopw')
|
||||
|
||||
|
||||
def test_HTTP_200_OK_GET(self):
|
||||
r = requests.get('http://google.com')
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
|
||||
def test_HTTPS_200_OK_GET(self):
|
||||
r = requests.get('https://google.com')
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
|
||||
def test_HTTP_200_OK_HEAD(self):
|
||||
r = requests.head('http://google.com')
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
|
||||
def test_HTTPS_200_OK_HEAD(self):
|
||||
r = requests.head('https://google.com')
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
|
||||
def test_AUTH_HTTPS_200_OK_GET(self):
|
||||
auth = requests.AuthObject('requeststest', 'requeststest')
|
||||
url = 'https://convore.com/api/account/verify.json'
|
||||
r = requests.get(url, auth=auth)
|
||||
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
|
||||
def test_POSTBIN_GET_POST_FILES(self):
|
||||
|
||||
bin = requests.post('http://www.postbin.org/')
|
||||
self.assertEqual(bin.status_code, 200)
|
||||
|
||||
post = requests.post(bin.url, data={'some': 'data'})
|
||||
self.assertEqual(post.status_code, 201)
|
||||
|
||||
post2 = requests.post(bin.url, files={'some': StringIO('data')})
|
||||
self.assertEqual(post2.status_code, 201)
|
||||
|
||||
|
||||
def test_nonzero_evaluation(self):
|
||||
r = requests.get('http://google.com/some-404-url')
|
||||
self.assertEqual(bool(r), False)
|
||||
|
||||
r = requests.get('http://google.com/')
|
||||
self.assertEqual(bool(r), True)
|
||||
|
||||
|
||||
def test_request_ok_set(self):
|
||||
r = requests.get('http://google.com/some-404-url')
|
||||
self.assertEqual(r.ok, False)
|
||||
|
||||
|
||||
def test_status_raising(self):
|
||||
r = requests.get('http://google.com/some-404-url')
|
||||
self.assertRaises(requests.HTTPError, r.raise_for_status)
|
||||
|
||||
r = requests.get('http://google.com/')
|
||||
self.assertFalse(r.error)
|
||||
r.raise_for_status()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
13
tests/__init__.py
Normal file
13
tests/__init__.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""Requests test package initialisation."""
|
||||
|
||||
import warnings
|
||||
|
||||
import urllib3
|
||||
from urllib3.exceptions import SNIMissingWarning
|
||||
|
||||
# urllib3 sets SNIMissingWarning to only go off once,
|
||||
# while this test suite requires it to always fire
|
||||
# so that it occurs during test_requests.test_https_warnings
|
||||
warnings.simplefilter('always', SNIMissingWarning)
|
||||
21
tests/compat.py
Normal file
21
tests/compat.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from requests.compat import is_py3
|
||||
|
||||
|
||||
try:
|
||||
import StringIO
|
||||
except ImportError:
|
||||
import io as StringIO
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO as cStringIO
|
||||
except ImportError:
|
||||
cStringIO = None
|
||||
|
||||
if is_py3:
|
||||
def u(s):
|
||||
return s
|
||||
else:
|
||||
def u(s):
|
||||
return s.decode('unicode-escape')
|
||||
24
tests/conftest.py
Normal file
24
tests/conftest.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pytest
|
||||
from requests.compat import urljoin
|
||||
|
||||
|
||||
def prepare_url(value):
|
||||
# Issue #1483: Make sure the URL always has a trailing slash
|
||||
httpbin_url = value.url.rstrip('/') + '/'
|
||||
|
||||
def inner(*suffix):
|
||||
return urljoin(httpbin_url, '/'.join(suffix))
|
||||
|
||||
return inner
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def httpbin(httpbin):
|
||||
return prepare_url(httpbin)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def httpbin_secure(httpbin_secure):
|
||||
return prepare_url(httpbin_secure)
|
||||
40
tests/test_help.py
Normal file
40
tests/test_help.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# -*- encoding: utf-8
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from requests.help import info
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info[:2] != (2,6), reason="Only run on Python 2.6")
|
||||
def test_system_ssl_py26():
|
||||
"""OPENSSL_VERSION_NUMBER isn't provided in Python 2.6, verify we don't
|
||||
blow up in this case.
|
||||
"""
|
||||
assert info()['system_ssl'] == {'version': ''}
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (2,7), reason="Only run on Python 2.7+")
|
||||
def test_system_ssl():
|
||||
"""Verify we're actually setting system_ssl when it should be available."""
|
||||
assert info()['system_ssl']['version'] != ''
|
||||
|
||||
|
||||
class VersionedPackage(object):
|
||||
def __init__(self, version):
|
||||
self.__version__ = version
|
||||
|
||||
|
||||
def test_idna_without_version_attribute(mocker):
|
||||
"""Older versions of IDNA don't provide a __version__ attribute, verify
|
||||
that if we have such a package, we don't blow up.
|
||||
"""
|
||||
mocker.patch('requests.help.idna', new=None)
|
||||
assert info()['idna'] == {'version': ''}
|
||||
|
||||
|
||||
def test_idna_with_version_attribute(mocker):
|
||||
"""Verify we're actually setting idna version when it should be available."""
|
||||
mocker.patch('requests.help.idna', new=VersionedPackage('2.6'))
|
||||
assert info()['idna'] == {'version': '2.6'}
|
||||
23
tests/test_hooks.py
Normal file
23
tests/test_hooks.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pytest
|
||||
|
||||
from requests import hooks
|
||||
|
||||
|
||||
def hook(value):
|
||||
return value[1:]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'hooks_list, result', (
|
||||
(hook, 'ata'),
|
||||
([hook, lambda x: None, hook], 'ta'),
|
||||
)
|
||||
)
|
||||
def test_hooks(hooks_list, result):
|
||||
assert hooks.dispatch_hook('response', {'response': hooks_list}, 'Data') == result
|
||||
|
||||
|
||||
def test_default_hooks():
|
||||
assert hooks.default_hooks() == {'response': []}
|
||||
237
tests/test_lowlevel.py
Normal file
237
tests/test_lowlevel.py
Normal file
@@ -0,0 +1,237 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pytest
|
||||
import threading
|
||||
import requests
|
||||
|
||||
from tests.testserver.server import Server, consume_socket_content
|
||||
|
||||
from .utils import override_environ
|
||||
|
||||
|
||||
def test_chunked_upload():
|
||||
"""can safely send generators"""
|
||||
close_server = threading.Event()
|
||||
server = Server.basic_response_server(wait_to_close_event=close_server)
|
||||
data = iter([b'a', b'b', b'c'])
|
||||
|
||||
with server as (host, port):
|
||||
url = 'http://{0}:{1}/'.format(host, port)
|
||||
r = requests.post(url, data=data, stream=True)
|
||||
close_server.set() # release server block
|
||||
|
||||
assert r.status_code == 200
|
||||
assert r.request.headers['Transfer-Encoding'] == 'chunked'
|
||||
|
||||
|
||||
def test_digestauth_401_count_reset_on_redirect():
|
||||
"""Ensure we correctly reset num_401_calls after a successful digest auth,
|
||||
followed by a 302 redirect to another digest auth prompt.
|
||||
|
||||
See https://github.com/requests/requests/issues/1979.
|
||||
"""
|
||||
text_401 = (b'HTTP/1.1 401 UNAUTHORIZED\r\n'
|
||||
b'Content-Length: 0\r\n'
|
||||
b'WWW-Authenticate: Digest nonce="6bf5d6e4da1ce66918800195d6b9130d"'
|
||||
b', opaque="372825293d1c26955496c80ed6426e9e", '
|
||||
b'realm="me@kennethreitz.com", qop=auth\r\n\r\n')
|
||||
|
||||
text_302 = (b'HTTP/1.1 302 FOUND\r\n'
|
||||
b'Content-Length: 0\r\n'
|
||||
b'Location: /\r\n\r\n')
|
||||
|
||||
text_200 = (b'HTTP/1.1 200 OK\r\n'
|
||||
b'Content-Length: 0\r\n\r\n')
|
||||
|
||||
expected_digest = (b'Authorization: Digest username="user", '
|
||||
b'realm="me@kennethreitz.com", '
|
||||
b'nonce="6bf5d6e4da1ce66918800195d6b9130d", uri="/"')
|
||||
|
||||
auth = requests.auth.HTTPDigestAuth('user', 'pass')
|
||||
|
||||
def digest_response_handler(sock):
|
||||
# Respond to initial GET with a challenge.
|
||||
request_content = consume_socket_content(sock, timeout=0.5)
|
||||
assert request_content.startswith(b"GET / HTTP/1.1")
|
||||
sock.send(text_401)
|
||||
|
||||
# Verify we receive an Authorization header in response, then redirect.
|
||||
request_content = consume_socket_content(sock, timeout=0.5)
|
||||
assert expected_digest in request_content
|
||||
sock.send(text_302)
|
||||
|
||||
# Verify Authorization isn't sent to the redirected host,
|
||||
# then send another challenge.
|
||||
request_content = consume_socket_content(sock, timeout=0.5)
|
||||
assert b'Authorization:' not in request_content
|
||||
sock.send(text_401)
|
||||
|
||||
# Verify Authorization is sent correctly again, and return 200 OK.
|
||||
request_content = consume_socket_content(sock, timeout=0.5)
|
||||
assert expected_digest in request_content
|
||||
sock.send(text_200)
|
||||
|
||||
return request_content
|
||||
|
||||
close_server = threading.Event()
|
||||
server = Server(digest_response_handler, wait_to_close_event=close_server)
|
||||
|
||||
with server as (host, port):
|
||||
url = 'http://{0}:{1}/'.format(host, port)
|
||||
r = requests.get(url, auth=auth)
|
||||
# Verify server succeeded in authenticating.
|
||||
assert r.status_code == 200
|
||||
# Verify Authorization was sent in final request.
|
||||
assert 'Authorization' in r.request.headers
|
||||
assert r.request.headers['Authorization'].startswith('Digest ')
|
||||
# Verify redirect happened as we expected.
|
||||
assert r.history[0].status_code == 302
|
||||
close_server.set()
|
||||
|
||||
|
||||
def test_digestauth_401_only_sent_once():
|
||||
"""Ensure we correctly respond to a 401 challenge once, and then
|
||||
stop responding if challenged again.
|
||||
"""
|
||||
text_401 = (b'HTTP/1.1 401 UNAUTHORIZED\r\n'
|
||||
b'Content-Length: 0\r\n'
|
||||
b'WWW-Authenticate: Digest nonce="6bf5d6e4da1ce66918800195d6b9130d"'
|
||||
b', opaque="372825293d1c26955496c80ed6426e9e", '
|
||||
b'realm="me@kennethreitz.com", qop=auth\r\n\r\n')
|
||||
|
||||
expected_digest = (b'Authorization: Digest username="user", '
|
||||
b'realm="me@kennethreitz.com", '
|
||||
b'nonce="6bf5d6e4da1ce66918800195d6b9130d", uri="/"')
|
||||
|
||||
auth = requests.auth.HTTPDigestAuth('user', 'pass')
|
||||
|
||||
def digest_failed_response_handler(sock):
|
||||
# Respond to initial GET with a challenge.
|
||||
request_content = consume_socket_content(sock, timeout=0.5)
|
||||
assert request_content.startswith(b"GET / HTTP/1.1")
|
||||
sock.send(text_401)
|
||||
|
||||
# Verify we receive an Authorization header in response, then
|
||||
# challenge again.
|
||||
request_content = consume_socket_content(sock, timeout=0.5)
|
||||
assert expected_digest in request_content
|
||||
sock.send(text_401)
|
||||
|
||||
# Verify the client didn't respond to second challenge.
|
||||
request_content = consume_socket_content(sock, timeout=0.5)
|
||||
assert request_content == b''
|
||||
|
||||
return request_content
|
||||
|
||||
close_server = threading.Event()
|
||||
server = Server(digest_failed_response_handler, wait_to_close_event=close_server)
|
||||
|
||||
with server as (host, port):
|
||||
url = 'http://{0}:{1}/'.format(host, port)
|
||||
r = requests.get(url, auth=auth)
|
||||
# Verify server didn't authenticate us.
|
||||
assert r.status_code == 401
|
||||
assert r.history[0].status_code == 401
|
||||
close_server.set()
|
||||
|
||||
|
||||
def test_digestauth_only_on_4xx():
|
||||
"""Ensure we only send digestauth on 4xx challenges.
|
||||
|
||||
See https://github.com/requests/requests/issues/3772.
|
||||
"""
|
||||
text_200_chal = (b'HTTP/1.1 200 OK\r\n'
|
||||
b'Content-Length: 0\r\n'
|
||||
b'WWW-Authenticate: Digest nonce="6bf5d6e4da1ce66918800195d6b9130d"'
|
||||
b', opaque="372825293d1c26955496c80ed6426e9e", '
|
||||
b'realm="me@kennethreitz.com", qop=auth\r\n\r\n')
|
||||
|
||||
auth = requests.auth.HTTPDigestAuth('user', 'pass')
|
||||
|
||||
def digest_response_handler(sock):
|
||||
# Respond to GET with a 200 containing www-authenticate header.
|
||||
request_content = consume_socket_content(sock, timeout=0.5)
|
||||
assert request_content.startswith(b"GET / HTTP/1.1")
|
||||
sock.send(text_200_chal)
|
||||
|
||||
# Verify the client didn't respond with auth.
|
||||
request_content = consume_socket_content(sock, timeout=0.5)
|
||||
assert request_content == b''
|
||||
|
||||
return request_content
|
||||
|
||||
close_server = threading.Event()
|
||||
server = Server(digest_response_handler, wait_to_close_event=close_server)
|
||||
|
||||
with server as (host, port):
|
||||
url = 'http://{0}:{1}/'.format(host, port)
|
||||
r = requests.get(url, auth=auth)
|
||||
# Verify server didn't receive auth from us.
|
||||
assert r.status_code == 200
|
||||
assert len(r.history) == 0
|
||||
close_server.set()
|
||||
|
||||
|
||||
_schemes_by_var_prefix = [
|
||||
('http', ['http']),
|
||||
('https', ['https']),
|
||||
('all', ['http', 'https']),
|
||||
]
|
||||
|
||||
_proxy_combos = []
|
||||
for prefix, schemes in _schemes_by_var_prefix:
|
||||
for scheme in schemes:
|
||||
_proxy_combos.append(("{0}_proxy".format(prefix), scheme))
|
||||
|
||||
_proxy_combos += [(var.upper(), scheme) for var, scheme in _proxy_combos]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("var,scheme", _proxy_combos)
|
||||
def test_use_proxy_from_environment(httpbin, var, scheme):
|
||||
url = "{0}://httpbin.org".format(scheme)
|
||||
fake_proxy = Server() # do nothing with the requests; just close the socket
|
||||
with fake_proxy as (host, port):
|
||||
proxy_url = "socks5://{0}:{1}".format(host, port)
|
||||
kwargs = {var: proxy_url}
|
||||
with override_environ(**kwargs):
|
||||
# fake proxy's lack of response will cause a ConnectionError
|
||||
with pytest.raises(requests.exceptions.ConnectionError):
|
||||
requests.get(url)
|
||||
|
||||
# the fake proxy received a request
|
||||
assert len(fake_proxy.handler_results) == 1
|
||||
|
||||
# it had actual content (not checking for SOCKS protocol for now)
|
||||
assert len(fake_proxy.handler_results[0]) > 0
|
||||
|
||||
|
||||
def test_redirect_rfc1808_to_non_ascii_location():
|
||||
path = u'š'
|
||||
expected_path = b'%C5%A1'
|
||||
redirect_request = [] # stores the second request to the server
|
||||
|
||||
def redirect_resp_handler(sock):
|
||||
consume_socket_content(sock, timeout=0.5)
|
||||
location = u'//{0}:{1}/{2}'.format(host, port, path)
|
||||
sock.send(
|
||||
b'HTTP/1.1 301 Moved Permanently\r\n'
|
||||
b'Content-Length: 0\r\n'
|
||||
b'Location: ' + location.encode('utf8') + b'\r\n'
|
||||
b'\r\n'
|
||||
)
|
||||
redirect_request.append(consume_socket_content(sock, timeout=0.5))
|
||||
sock.send(b'HTTP/1.1 200 OK\r\n\r\n')
|
||||
|
||||
close_server = threading.Event()
|
||||
server = Server(redirect_resp_handler, wait_to_close_event=close_server)
|
||||
|
||||
with server as (host, port):
|
||||
url = u'http://{0}:{1}'.format(host, port)
|
||||
r = requests.get(url=url, allow_redirects=True)
|
||||
assert r.status_code == 200
|
||||
assert len(r.history) == 1
|
||||
assert r.history[0].status_code == 301
|
||||
assert redirect_request[0].startswith(b'GET /' + expected_path + b' HTTP/1.1')
|
||||
assert r.url == u'{0}/{1}'.format(url, expected_path.decode('ascii'))
|
||||
|
||||
close_server.set()
|
||||
13
tests/test_packages.py
Normal file
13
tests/test_packages.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import requests
|
||||
|
||||
|
||||
def test_can_access_urllib3_attribute():
|
||||
requests.packages.urllib3
|
||||
|
||||
|
||||
def test_can_access_idna_attribute():
|
||||
requests.packages.idna
|
||||
|
||||
|
||||
def test_can_access_chardet_attribute():
|
||||
requests.packages.chardet
|
||||
2389
tests/test_requests.py
Normal file
2389
tests/test_requests.py
Normal file
File diff suppressed because it is too large
Load Diff
76
tests/test_structures.py
Normal file
76
tests/test_structures.py
Normal file
@@ -0,0 +1,76 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pytest
|
||||
|
||||
from requests.structures import CaseInsensitiveDict, LookupDict
|
||||
|
||||
|
||||
class TestCaseInsensitiveDict:
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup(self):
|
||||
"""CaseInsensitiveDict instance with "Accept" header."""
|
||||
self.case_insensitive_dict = CaseInsensitiveDict()
|
||||
self.case_insensitive_dict['Accept'] = 'application/json'
|
||||
|
||||
def test_list(self):
|
||||
assert list(self.case_insensitive_dict) == ['Accept']
|
||||
|
||||
possible_keys = pytest.mark.parametrize('key', ('accept', 'ACCEPT', 'aCcEpT', 'Accept'))
|
||||
|
||||
@possible_keys
|
||||
def test_getitem(self, key):
|
||||
assert self.case_insensitive_dict[key] == 'application/json'
|
||||
|
||||
@possible_keys
|
||||
def test_delitem(self, key):
|
||||
del self.case_insensitive_dict[key]
|
||||
assert key not in self.case_insensitive_dict
|
||||
|
||||
def test_lower_items(self):
|
||||
assert list(self.case_insensitive_dict.lower_items()) == [('accept', 'application/json')]
|
||||
|
||||
def test_repr(self):
|
||||
assert repr(self.case_insensitive_dict) == "{'Accept': 'application/json'}"
|
||||
|
||||
def test_copy(self):
|
||||
copy = self.case_insensitive_dict.copy()
|
||||
assert copy is not self.case_insensitive_dict
|
||||
assert copy == self.case_insensitive_dict
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'other, result', (
|
||||
({'AccePT': 'application/json'}, True),
|
||||
({}, False),
|
||||
(None, False)
|
||||
)
|
||||
)
|
||||
def test_instance_equality(self, other, result):
|
||||
assert (self.case_insensitive_dict == other) is result
|
||||
|
||||
|
||||
class TestLookupDict:
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup(self):
|
||||
"""LookupDict instance with "bad_gateway" attribute."""
|
||||
self.lookup_dict = LookupDict('test')
|
||||
self.lookup_dict.bad_gateway = 502
|
||||
|
||||
def test_repr(self):
|
||||
assert repr(self.lookup_dict) == "<lookup 'test'>"
|
||||
|
||||
get_item_parameters = pytest.mark.parametrize(
|
||||
'key, value', (
|
||||
('bad_gateway', 502),
|
||||
('not_a_key', None)
|
||||
)
|
||||
)
|
||||
|
||||
@get_item_parameters
|
||||
def test_getitem(self, key, value):
|
||||
assert self.lookup_dict[key] == value
|
||||
|
||||
@get_item_parameters
|
||||
def test_get(self, key, value):
|
||||
assert self.lookup_dict.get(key) == value
|
||||
166
tests/test_testserver.py
Normal file
166
tests/test_testserver.py
Normal file
@@ -0,0 +1,166 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import threading
|
||||
import socket
|
||||
import time
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
from tests.testserver.server import Server
|
||||
|
||||
|
||||
class TestTestServer:
|
||||
|
||||
def test_basic(self):
|
||||
"""messages are sent and received properly"""
|
||||
question = b"success?"
|
||||
answer = b"yeah, success"
|
||||
|
||||
def handler(sock):
|
||||
text = sock.recv(1000)
|
||||
assert text == question
|
||||
sock.sendall(answer)
|
||||
|
||||
with Server(handler) as (host, port):
|
||||
sock = socket.socket()
|
||||
sock.connect((host, port))
|
||||
sock.sendall(question)
|
||||
text = sock.recv(1000)
|
||||
assert text == answer
|
||||
sock.close()
|
||||
|
||||
def test_server_closes(self):
|
||||
"""the server closes when leaving the context manager"""
|
||||
with Server.basic_response_server() as (host, port):
|
||||
sock = socket.socket()
|
||||
sock.connect((host, port))
|
||||
|
||||
sock.close()
|
||||
|
||||
with pytest.raises(socket.error):
|
||||
new_sock = socket.socket()
|
||||
new_sock.connect((host, port))
|
||||
|
||||
def test_text_response(self):
|
||||
"""the text_response_server sends the given text"""
|
||||
server = Server.text_response_server(
|
||||
"HTTP/1.1 200 OK\r\n" +
|
||||
"Content-Length: 6\r\n" +
|
||||
"\r\nroflol"
|
||||
)
|
||||
|
||||
with server as (host, port):
|
||||
r = requests.get('http://{0}:{1}'.format(host, port))
|
||||
|
||||
assert r.status_code == 200
|
||||
assert r.text == u'roflol'
|
||||
assert r.headers['Content-Length'] == '6'
|
||||
|
||||
def test_basic_response(self):
|
||||
"""the basic response server returns an empty http response"""
|
||||
with Server.basic_response_server() as (host, port):
|
||||
r = requests.get('http://{0}:{1}'.format(host, port))
|
||||
assert r.status_code == 200
|
||||
assert r.text == u''
|
||||
assert r.headers['Content-Length'] == '0'
|
||||
|
||||
def test_basic_waiting_server(self):
|
||||
"""the server waits for the block_server event to be set before closing"""
|
||||
block_server = threading.Event()
|
||||
|
||||
with Server.basic_response_server(wait_to_close_event=block_server) as (host, port):
|
||||
sock = socket.socket()
|
||||
sock.connect((host, port))
|
||||
sock.sendall(b'send something')
|
||||
time.sleep(2.5)
|
||||
sock.sendall(b'still alive')
|
||||
block_server.set() # release server block
|
||||
|
||||
def test_multiple_requests(self):
|
||||
"""multiple requests can be served"""
|
||||
requests_to_handle = 5
|
||||
|
||||
server = Server.basic_response_server(requests_to_handle=requests_to_handle)
|
||||
|
||||
with server as (host, port):
|
||||
server_url = 'http://{0}:{1}'.format(host, port)
|
||||
for _ in range(requests_to_handle):
|
||||
r = requests.get(server_url)
|
||||
assert r.status_code == 200
|
||||
|
||||
# the (n+1)th request fails
|
||||
with pytest.raises(requests.exceptions.ConnectionError):
|
||||
r = requests.get(server_url)
|
||||
|
||||
@pytest.mark.skip(reason="this fails non-deterministically under pytest-xdist")
|
||||
def test_request_recovery(self):
|
||||
"""can check the requests content"""
|
||||
# TODO: figure out why this sometimes fails when using pytest-xdist.
|
||||
server = Server.basic_response_server(requests_to_handle=2)
|
||||
first_request = b'put your hands up in the air'
|
||||
second_request = b'put your hand down in the floor'
|
||||
|
||||
with server as address:
|
||||
sock1 = socket.socket()
|
||||
sock2 = socket.socket()
|
||||
|
||||
sock1.connect(address)
|
||||
sock1.sendall(first_request)
|
||||
sock1.close()
|
||||
|
||||
sock2.connect(address)
|
||||
sock2.sendall(second_request)
|
||||
sock2.close()
|
||||
|
||||
assert server.handler_results[0] == first_request
|
||||
assert server.handler_results[1] == second_request
|
||||
|
||||
def test_requests_after_timeout_are_not_received(self):
|
||||
"""the basic response handler times out when receiving requests"""
|
||||
server = Server.basic_response_server(request_timeout=1)
|
||||
|
||||
with server as address:
|
||||
sock = socket.socket()
|
||||
sock.connect(address)
|
||||
time.sleep(1.5)
|
||||
sock.sendall(b'hehehe, not received')
|
||||
sock.close()
|
||||
|
||||
assert server.handler_results[0] == b''
|
||||
|
||||
def test_request_recovery_with_bigger_timeout(self):
|
||||
"""a biggest timeout can be specified"""
|
||||
server = Server.basic_response_server(request_timeout=3)
|
||||
data = b'bananadine'
|
||||
|
||||
with server as address:
|
||||
sock = socket.socket()
|
||||
sock.connect(address)
|
||||
time.sleep(1.5)
|
||||
sock.sendall(data)
|
||||
sock.close()
|
||||
|
||||
assert server.handler_results[0] == data
|
||||
|
||||
def test_server_finishes_on_error(self):
|
||||
"""the server thread exits even if an exception exits the context manager"""
|
||||
server = Server.basic_response_server()
|
||||
with pytest.raises(Exception):
|
||||
with server:
|
||||
raise Exception()
|
||||
|
||||
assert len(server.handler_results) == 0
|
||||
|
||||
# if the server thread fails to finish, the test suite will hang
|
||||
# and get killed by the jenkins timeout.
|
||||
|
||||
def test_server_finishes_when_no_connections(self):
|
||||
"""the server thread exits even if there are no connections"""
|
||||
server = Server.basic_response_server()
|
||||
with server:
|
||||
pass
|
||||
|
||||
assert len(server.handler_results) == 0
|
||||
|
||||
# if the server thread fails to finish, the test suite will hang
|
||||
# and get killed by the jenkins timeout.
|
||||
680
tests/test_utils.py
Normal file
680
tests/test_utils.py
Normal file
@@ -0,0 +1,680 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import copy
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
from requests import compat
|
||||
from requests.cookies import RequestsCookieJar
|
||||
from requests.structures import CaseInsensitiveDict
|
||||
from requests.utils import (
|
||||
address_in_network, dotted_netmask,
|
||||
get_auth_from_url, get_encoding_from_headers,
|
||||
get_encodings_from_content, get_environ_proxies,
|
||||
guess_filename, guess_json_utf, is_ipv4_address,
|
||||
is_valid_cidr, iter_slices, parse_dict_header,
|
||||
parse_header_links, prepend_scheme_if_needed,
|
||||
requote_uri, select_proxy, should_bypass_proxies, super_len,
|
||||
to_key_val_list, to_native_string,
|
||||
unquote_header_value, unquote_unreserved,
|
||||
urldefragauth, add_dict_to_cookiejar, set_environ)
|
||||
from requests._internal_utils import unicode_is_ascii
|
||||
|
||||
from .compat import StringIO, cStringIO
|
||||
|
||||
|
||||
class TestSuperLen:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'stream, value', (
|
||||
(StringIO.StringIO, 'Test'),
|
||||
(BytesIO, b'Test'),
|
||||
pytest.mark.skipif('cStringIO is None')((cStringIO, 'Test')),
|
||||
))
|
||||
def test_io_streams(self, stream, value):
|
||||
"""Ensures that we properly deal with different kinds of IO streams."""
|
||||
assert super_len(stream()) == 0
|
||||
assert super_len(stream(value)) == 4
|
||||
|
||||
def test_super_len_correctly_calculates_len_of_partially_read_file(self):
|
||||
"""Ensure that we handle partially consumed file like objects."""
|
||||
s = StringIO.StringIO()
|
||||
s.write('foobarbogus')
|
||||
assert super_len(s) == 0
|
||||
|
||||
@pytest.mark.parametrize('error', [IOError, OSError])
|
||||
def test_super_len_handles_files_raising_weird_errors_in_tell(self, error):
|
||||
"""If tell() raises errors, assume the cursor is at position zero."""
|
||||
class BoomFile(object):
|
||||
def __len__(self):
|
||||
return 5
|
||||
|
||||
def tell(self):
|
||||
raise error()
|
||||
|
||||
assert super_len(BoomFile()) == 0
|
||||
|
||||
@pytest.mark.parametrize('error', [IOError, OSError])
|
||||
def test_super_len_tell_ioerror(self, error):
|
||||
"""Ensure that if tell gives an IOError super_len doesn't fail"""
|
||||
class NoLenBoomFile(object):
|
||||
def tell(self):
|
||||
raise error()
|
||||
|
||||
def seek(self, offset, whence):
|
||||
pass
|
||||
|
||||
assert super_len(NoLenBoomFile()) == 0
|
||||
|
||||
def test_string(self):
|
||||
assert super_len('Test') == 4
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'mode, warnings_num', (
|
||||
('r', 1),
|
||||
('rb', 0),
|
||||
))
|
||||
def test_file(self, tmpdir, mode, warnings_num, recwarn):
|
||||
file_obj = tmpdir.join('test.txt')
|
||||
file_obj.write('Test')
|
||||
with file_obj.open(mode) as fd:
|
||||
assert super_len(fd) == 4
|
||||
assert len(recwarn) == warnings_num
|
||||
|
||||
def test_super_len_with__len__(self):
|
||||
foo = [1,2,3,4]
|
||||
len_foo = super_len(foo)
|
||||
assert len_foo == 4
|
||||
|
||||
def test_super_len_with_no__len__(self):
|
||||
class LenFile(object):
|
||||
def __init__(self):
|
||||
self.len = 5
|
||||
|
||||
assert super_len(LenFile()) == 5
|
||||
|
||||
def test_super_len_with_tell(self):
|
||||
foo = StringIO.StringIO('12345')
|
||||
assert super_len(foo) == 5
|
||||
foo.read(2)
|
||||
assert super_len(foo) == 3
|
||||
|
||||
def test_super_len_with_fileno(self):
|
||||
with open(__file__, 'rb') as f:
|
||||
length = super_len(f)
|
||||
file_data = f.read()
|
||||
assert length == len(file_data)
|
||||
|
||||
def test_super_len_with_no_matches(self):
|
||||
"""Ensure that objects without any length methods default to 0"""
|
||||
assert super_len(object()) == 0
|
||||
|
||||
|
||||
class TestToKeyValList:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value, expected', (
|
||||
([('key', 'val')], [('key', 'val')]),
|
||||
((('key', 'val'), ), [('key', 'val')]),
|
||||
({'key': 'val'}, [('key', 'val')]),
|
||||
(None, None)
|
||||
))
|
||||
def test_valid(self, value, expected):
|
||||
assert to_key_val_list(value) == expected
|
||||
|
||||
def test_invalid(self):
|
||||
with pytest.raises(ValueError):
|
||||
to_key_val_list('string')
|
||||
|
||||
|
||||
class TestUnquoteHeaderValue:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value, expected', (
|
||||
(None, None),
|
||||
('Test', 'Test'),
|
||||
('"Test"', 'Test'),
|
||||
('"Test\\\\"', 'Test\\'),
|
||||
('"\\\\Comp\\Res"', '\\Comp\\Res'),
|
||||
))
|
||||
def test_valid(self, value, expected):
|
||||
assert unquote_header_value(value) == expected
|
||||
|
||||
def test_is_filename(self):
|
||||
assert unquote_header_value('"\\\\Comp\\Res"', True) == '\\\\Comp\\Res'
|
||||
|
||||
|
||||
class TestGetEnvironProxies:
|
||||
"""Ensures that IP addresses are correctly matches with ranges
|
||||
in no_proxy variable.
|
||||
"""
|
||||
|
||||
@pytest.fixture(autouse=True, params=['no_proxy', 'NO_PROXY'])
|
||||
def no_proxy(self, request, monkeypatch):
|
||||
monkeypatch.setenv(request.param, '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'url', (
|
||||
'http://192.168.0.1:5000/',
|
||||
'http://192.168.0.1/',
|
||||
'http://172.16.1.1/',
|
||||
'http://172.16.1.1:5000/',
|
||||
'http://localhost.localdomain:5000/v1.0/',
|
||||
))
|
||||
def test_bypass(self, url):
|
||||
assert get_environ_proxies(url, no_proxy=None) == {}
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'url', (
|
||||
'http://192.168.1.1:5000/',
|
||||
'http://192.168.1.1/',
|
||||
'http://www.requests.com/',
|
||||
))
|
||||
def test_not_bypass(self, url):
|
||||
assert get_environ_proxies(url, no_proxy=None) != {}
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'url', (
|
||||
'http://192.168.1.1:5000/',
|
||||
'http://192.168.1.1/',
|
||||
'http://www.requests.com/',
|
||||
))
|
||||
def test_bypass_no_proxy_keyword(self, url):
|
||||
no_proxy = '192.168.1.1,requests.com'
|
||||
assert get_environ_proxies(url, no_proxy=no_proxy) == {}
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'url', (
|
||||
'http://192.168.0.1:5000/',
|
||||
'http://192.168.0.1/',
|
||||
'http://172.16.1.1/',
|
||||
'http://172.16.1.1:5000/',
|
||||
'http://localhost.localdomain:5000/v1.0/',
|
||||
))
|
||||
def test_not_bypass_no_proxy_keyword(self, url, monkeypatch):
|
||||
# This is testing that the 'no_proxy' argument overrides the
|
||||
# environment variable 'no_proxy'
|
||||
monkeypatch.setenv('http_proxy', 'http://proxy.example.com:3128/')
|
||||
no_proxy = '192.168.1.1,requests.com'
|
||||
assert get_environ_proxies(url, no_proxy=no_proxy) != {}
|
||||
|
||||
|
||||
class TestIsIPv4Address:
|
||||
|
||||
def test_valid(self):
|
||||
assert is_ipv4_address('8.8.8.8')
|
||||
|
||||
@pytest.mark.parametrize('value', ('8.8.8.8.8', 'localhost.localdomain'))
|
||||
def test_invalid(self, value):
|
||||
assert not is_ipv4_address(value)
|
||||
|
||||
|
||||
class TestIsValidCIDR:
|
||||
|
||||
def test_valid(self):
|
||||
assert is_valid_cidr('192.168.1.0/24')
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value', (
|
||||
'8.8.8.8',
|
||||
'192.168.1.0/a',
|
||||
'192.168.1.0/128',
|
||||
'192.168.1.0/-1',
|
||||
'192.168.1.999/24',
|
||||
))
|
||||
def test_invalid(self, value):
|
||||
assert not is_valid_cidr(value)
|
||||
|
||||
|
||||
class TestAddressInNetwork:
|
||||
|
||||
def test_valid(self):
|
||||
assert address_in_network('192.168.1.1', '192.168.1.0/24')
|
||||
|
||||
def test_invalid(self):
|
||||
assert not address_in_network('172.16.0.1', '192.168.1.0/24')
|
||||
|
||||
|
||||
class TestGuessFilename:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value', (1, type('Fake', (object,), {'name': 1})()),
|
||||
)
|
||||
def test_guess_filename_invalid(self, value):
|
||||
assert guess_filename(value) is None
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value, expected_type', (
|
||||
(b'value', compat.bytes),
|
||||
(b'value'.decode('utf-8'), compat.str)
|
||||
))
|
||||
def test_guess_filename_valid(self, value, expected_type):
|
||||
obj = type('Fake', (object,), {'name': value})()
|
||||
result = guess_filename(obj)
|
||||
assert result == value
|
||||
assert isinstance(result, expected_type)
|
||||
|
||||
|
||||
class TestContentEncodingDetection:
|
||||
|
||||
def test_none(self):
|
||||
encodings = get_encodings_from_content('')
|
||||
assert not len(encodings)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'content', (
|
||||
# HTML5 meta charset attribute
|
||||
'<meta charset="UTF-8">',
|
||||
# HTML4 pragma directive
|
||||
'<meta http-equiv="Content-type" content="text/html;charset=UTF-8">',
|
||||
# XHTML 1.x served with text/html MIME type
|
||||
'<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />',
|
||||
# XHTML 1.x served as XML
|
||||
'<?xml version="1.0" encoding="UTF-8"?>',
|
||||
))
|
||||
def test_pragmas(self, content):
|
||||
encodings = get_encodings_from_content(content)
|
||||
assert len(encodings) == 1
|
||||
assert encodings[0] == 'UTF-8'
|
||||
|
||||
def test_precedence(self):
|
||||
content = '''
|
||||
<?xml version="1.0" encoding="XML"?>
|
||||
<meta charset="HTML5">
|
||||
<meta http-equiv="Content-type" content="text/html;charset=HTML4" />
|
||||
'''.strip()
|
||||
assert get_encodings_from_content(content) == ['HTML5', 'HTML4', 'XML']
|
||||
|
||||
|
||||
class TestGuessJSONUTF:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'encoding', (
|
||||
'utf-32', 'utf-8-sig', 'utf-16', 'utf-8', 'utf-16-be', 'utf-16-le',
|
||||
'utf-32-be', 'utf-32-le'
|
||||
))
|
||||
def test_encoded(self, encoding):
|
||||
data = '{}'.encode(encoding)
|
||||
assert guess_json_utf(data) == encoding
|
||||
|
||||
def test_bad_utf_like_encoding(self):
|
||||
assert guess_json_utf(b'\x00\x00\x00\x00') is None
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
('encoding', 'expected'), (
|
||||
('utf-16-be', 'utf-16'),
|
||||
('utf-16-le', 'utf-16'),
|
||||
('utf-32-be', 'utf-32'),
|
||||
('utf-32-le', 'utf-32')
|
||||
))
|
||||
def test_guess_by_bom(self, encoding, expected):
|
||||
data = u'\ufeff{}'.encode(encoding)
|
||||
assert guess_json_utf(data) == expected
|
||||
|
||||
|
||||
USER = PASSWORD = "%!*'();:@&=+$,/?#[] "
|
||||
ENCODED_USER = compat.quote(USER, '')
|
||||
ENCODED_PASSWORD = compat.quote(PASSWORD, '')
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'url, auth', (
|
||||
(
|
||||
'http://' + ENCODED_USER + ':' + ENCODED_PASSWORD + '@' +
|
||||
'request.com/url.html#test',
|
||||
(USER, PASSWORD)
|
||||
),
|
||||
(
|
||||
'http://user:pass@complex.url.com/path?query=yes',
|
||||
('user', 'pass')
|
||||
),
|
||||
(
|
||||
'http://user:pass%20pass@complex.url.com/path?query=yes',
|
||||
('user', 'pass pass')
|
||||
),
|
||||
(
|
||||
'http://user:pass pass@complex.url.com/path?query=yes',
|
||||
('user', 'pass pass')
|
||||
),
|
||||
(
|
||||
'http://user%25user:pass@complex.url.com/path?query=yes',
|
||||
('user%user', 'pass')
|
||||
),
|
||||
(
|
||||
'http://user:pass%23pass@complex.url.com/path?query=yes',
|
||||
('user', 'pass#pass')
|
||||
),
|
||||
(
|
||||
'http://complex.url.com/path?query=yes',
|
||||
('', '')
|
||||
),
|
||||
))
|
||||
def test_get_auth_from_url(url, auth):
|
||||
assert get_auth_from_url(url) == auth
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'uri, expected', (
|
||||
(
|
||||
# Ensure requoting doesn't break expectations
|
||||
'http://example.com/fiz?buz=%25ppicture',
|
||||
'http://example.com/fiz?buz=%25ppicture',
|
||||
),
|
||||
(
|
||||
# Ensure we handle unquoted percent signs in redirects
|
||||
'http://example.com/fiz?buz=%ppicture',
|
||||
'http://example.com/fiz?buz=%25ppicture',
|
||||
),
|
||||
))
|
||||
def test_requote_uri_with_unquoted_percents(uri, expected):
|
||||
"""See: https://github.com/requests/requests/issues/2356"""
|
||||
assert requote_uri(uri) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'uri, expected', (
|
||||
(
|
||||
# Illegal bytes
|
||||
'http://example.com/?a=%--',
|
||||
'http://example.com/?a=%--',
|
||||
),
|
||||
(
|
||||
# Reserved characters
|
||||
'http://example.com/?a=%300',
|
||||
'http://example.com/?a=00',
|
||||
)
|
||||
))
|
||||
def test_unquote_unreserved(uri, expected):
|
||||
assert unquote_unreserved(uri) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'mask, expected', (
|
||||
(8, '255.0.0.0'),
|
||||
(24, '255.255.255.0'),
|
||||
(25, '255.255.255.128'),
|
||||
))
|
||||
def test_dotted_netmask(mask, expected):
|
||||
assert dotted_netmask(mask) == expected
|
||||
|
||||
|
||||
http_proxies = {'http': 'http://http.proxy',
|
||||
'http://some.host': 'http://some.host.proxy'}
|
||||
all_proxies = {'all': 'socks5://http.proxy',
|
||||
'all://some.host': 'socks5://some.host.proxy'}
|
||||
mixed_proxies = {'http': 'http://http.proxy',
|
||||
'http://some.host': 'http://some.host.proxy',
|
||||
'all': 'socks5://http.proxy'}
|
||||
@pytest.mark.parametrize(
|
||||
'url, expected, proxies', (
|
||||
('hTTp://u:p@Some.Host/path', 'http://some.host.proxy', http_proxies),
|
||||
('hTTp://u:p@Other.Host/path', 'http://http.proxy', http_proxies),
|
||||
('hTTp:///path', 'http://http.proxy', http_proxies),
|
||||
('hTTps://Other.Host', None, http_proxies),
|
||||
('file:///etc/motd', None, http_proxies),
|
||||
|
||||
('hTTp://u:p@Some.Host/path', 'socks5://some.host.proxy', all_proxies),
|
||||
('hTTp://u:p@Other.Host/path', 'socks5://http.proxy', all_proxies),
|
||||
('hTTp:///path', 'socks5://http.proxy', all_proxies),
|
||||
('hTTps://Other.Host', 'socks5://http.proxy', all_proxies),
|
||||
|
||||
('http://u:p@other.host/path', 'http://http.proxy', mixed_proxies),
|
||||
('http://u:p@some.host/path', 'http://some.host.proxy', mixed_proxies),
|
||||
('https://u:p@other.host/path', 'socks5://http.proxy', mixed_proxies),
|
||||
('https://u:p@some.host/path', 'socks5://http.proxy', mixed_proxies),
|
||||
('https://', 'socks5://http.proxy', mixed_proxies),
|
||||
# XXX: unsure whether this is reasonable behavior
|
||||
('file:///etc/motd', 'socks5://http.proxy', all_proxies),
|
||||
))
|
||||
def test_select_proxies(url, expected, proxies):
|
||||
"""Make sure we can select per-host proxies correctly."""
|
||||
assert select_proxy(url, proxies) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value, expected', (
|
||||
('foo="is a fish", bar="as well"', {'foo': 'is a fish', 'bar': 'as well'}),
|
||||
('key_without_value', {'key_without_value': None})
|
||||
))
|
||||
def test_parse_dict_header(value, expected):
|
||||
assert parse_dict_header(value) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value, expected', (
|
||||
(
|
||||
CaseInsensitiveDict(),
|
||||
None
|
||||
),
|
||||
(
|
||||
CaseInsensitiveDict({'content-type': 'application/json; charset=utf-8'}),
|
||||
'utf-8'
|
||||
),
|
||||
(
|
||||
CaseInsensitiveDict({'content-type': 'text/plain'}),
|
||||
'ISO-8859-1'
|
||||
),
|
||||
))
|
||||
def test_get_encoding_from_headers(value, expected):
|
||||
assert get_encoding_from_headers(value) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value, length', (
|
||||
('', 0),
|
||||
('T', 1),
|
||||
('Test', 4),
|
||||
('Cont', 0),
|
||||
('Other', -5),
|
||||
('Content', None),
|
||||
))
|
||||
def test_iter_slices(value, length):
|
||||
if length is None or (length <= 0 and len(value) > 0):
|
||||
# Reads all content at once
|
||||
assert len(list(iter_slices(value, length))) == 1
|
||||
else:
|
||||
assert len(list(iter_slices(value, 1))) == length
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value, expected', (
|
||||
(
|
||||
'<http:/.../front.jpeg>; rel=front; type="image/jpeg"',
|
||||
[{'url': 'http:/.../front.jpeg', 'rel': 'front', 'type': 'image/jpeg'}]
|
||||
),
|
||||
(
|
||||
'<http:/.../front.jpeg>',
|
||||
[{'url': 'http:/.../front.jpeg'}]
|
||||
),
|
||||
(
|
||||
'<http:/.../front.jpeg>;',
|
||||
[{'url': 'http:/.../front.jpeg'}]
|
||||
),
|
||||
(
|
||||
'<http:/.../front.jpeg>; type="image/jpeg",<http://.../back.jpeg>;',
|
||||
[
|
||||
{'url': 'http:/.../front.jpeg', 'type': 'image/jpeg'},
|
||||
{'url': 'http://.../back.jpeg'}
|
||||
]
|
||||
),
|
||||
))
|
||||
def test_parse_header_links(value, expected):
|
||||
assert parse_header_links(value) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value, expected', (
|
||||
('example.com/path', 'http://example.com/path'),
|
||||
('//example.com/path', 'http://example.com/path'),
|
||||
))
|
||||
def test_prepend_scheme_if_needed(value, expected):
|
||||
assert prepend_scheme_if_needed(value, 'http') == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value, expected', (
|
||||
('T', 'T'),
|
||||
(b'T', 'T'),
|
||||
(u'T', 'T'),
|
||||
))
|
||||
def test_to_native_string(value, expected):
|
||||
assert to_native_string(value) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'url, expected', (
|
||||
('http://u:p@example.com/path?a=1#test', 'http://example.com/path?a=1'),
|
||||
('http://example.com/path', 'http://example.com/path'),
|
||||
('//u:p@example.com/path', '//example.com/path'),
|
||||
('//example.com/path', '//example.com/path'),
|
||||
('example.com/path', '//example.com/path'),
|
||||
('scheme:u:p@example.com/path', 'scheme://example.com/path'),
|
||||
))
|
||||
def test_urldefragauth(url, expected):
|
||||
assert urldefragauth(url) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'url, expected', (
|
||||
('http://192.168.0.1:5000/', True),
|
||||
('http://192.168.0.1/', True),
|
||||
('http://172.16.1.1/', True),
|
||||
('http://172.16.1.1:5000/', True),
|
||||
('http://localhost.localdomain:5000/v1.0/', True),
|
||||
('http://172.16.1.12/', False),
|
||||
('http://172.16.1.12:5000/', False),
|
||||
('http://google.com:5000/v1.0/', False),
|
||||
))
|
||||
def test_should_bypass_proxies(url, expected, monkeypatch):
|
||||
"""Tests for function should_bypass_proxies to check if proxy
|
||||
can be bypassed or not
|
||||
"""
|
||||
monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')
|
||||
monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')
|
||||
assert should_bypass_proxies(url, no_proxy=None) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'cookiejar', (
|
||||
compat.cookielib.CookieJar(),
|
||||
RequestsCookieJar()
|
||||
))
|
||||
def test_add_dict_to_cookiejar(cookiejar):
|
||||
"""Ensure add_dict_to_cookiejar works for
|
||||
non-RequestsCookieJar CookieJars
|
||||
"""
|
||||
cookiedict = {'test': 'cookies',
|
||||
'good': 'cookies'}
|
||||
cj = add_dict_to_cookiejar(cookiejar, cookiedict)
|
||||
cookies = dict((cookie.name, cookie.value) for cookie in cj)
|
||||
assert cookiedict == cookies
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'value, expected', (
|
||||
(u'test', True),
|
||||
(u'æíöû', False),
|
||||
(u'ジェーピーニック', False),
|
||||
)
|
||||
)
|
||||
def test_unicode_is_ascii(value, expected):
|
||||
assert unicode_is_ascii(value) is expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'url, expected', (
|
||||
('http://192.168.0.1:5000/', True),
|
||||
('http://192.168.0.1/', True),
|
||||
('http://172.16.1.1/', True),
|
||||
('http://172.16.1.1:5000/', True),
|
||||
('http://localhost.localdomain:5000/v1.0/', True),
|
||||
('http://172.16.1.12/', False),
|
||||
('http://172.16.1.12:5000/', False),
|
||||
('http://google.com:5000/v1.0/', False),
|
||||
))
|
||||
def test_should_bypass_proxies_no_proxy(
|
||||
url, expected, monkeypatch):
|
||||
"""Tests for function should_bypass_proxies to check if proxy
|
||||
can be bypassed or not using the 'no_proxy' argument
|
||||
"""
|
||||
no_proxy = '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1'
|
||||
# Test 'no_proxy' argument
|
||||
assert should_bypass_proxies(url, no_proxy=no_proxy) == expected
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name != 'nt', reason='Test only on Windows')
|
||||
@pytest.mark.parametrize(
|
||||
'url, expected, override', (
|
||||
('http://192.168.0.1:5000/', True, None),
|
||||
('http://192.168.0.1/', True, None),
|
||||
('http://172.16.1.1/', True, None),
|
||||
('http://172.16.1.1:5000/', True, None),
|
||||
('http://localhost.localdomain:5000/v1.0/', True, None),
|
||||
('http://172.16.1.22/', False, None),
|
||||
('http://172.16.1.22:5000/', False, None),
|
||||
('http://google.com:5000/v1.0/', False, None),
|
||||
('http://mylocalhostname:5000/v1.0/', True, '<local>'),
|
||||
('http://192.168.0.1/', False, ''),
|
||||
))
|
||||
def test_should_bypass_proxies_win_registry(url, expected, override,
|
||||
monkeypatch):
|
||||
"""Tests for function should_bypass_proxies to check if proxy
|
||||
can be bypassed or not with Windows registry settings
|
||||
"""
|
||||
if override is None:
|
||||
override = '192.168.*;127.0.0.1;localhost.localdomain;172.16.1.1'
|
||||
if compat.is_py3:
|
||||
import winreg
|
||||
else:
|
||||
import _winreg as winreg
|
||||
|
||||
class RegHandle:
|
||||
def Close(self):
|
||||
pass
|
||||
|
||||
ie_settings = RegHandle()
|
||||
|
||||
def OpenKey(key, subkey):
|
||||
return ie_settings
|
||||
|
||||
def QueryValueEx(key, value_name):
|
||||
if key is ie_settings:
|
||||
if value_name == 'ProxyEnable':
|
||||
return [1]
|
||||
elif value_name == 'ProxyOverride':
|
||||
return [override]
|
||||
|
||||
monkeypatch.setenv('http_proxy', '')
|
||||
monkeypatch.setenv('https_proxy', '')
|
||||
monkeypatch.setenv('ftp_proxy', '')
|
||||
monkeypatch.setenv('no_proxy', '')
|
||||
monkeypatch.setenv('NO_PROXY', '')
|
||||
monkeypatch.setattr(winreg, 'OpenKey', OpenKey)
|
||||
monkeypatch.setattr(winreg, 'QueryValueEx', QueryValueEx)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'env_name, value', (
|
||||
('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain'),
|
||||
('no_proxy', None),
|
||||
('a_new_key', '192.168.0.0/24,127.0.0.1,localhost.localdomain'),
|
||||
('a_new_key', None),
|
||||
))
|
||||
def test_set_environ(env_name, value):
|
||||
"""Tests set_environ will set environ values and will restore the environ."""
|
||||
environ_copy = copy.deepcopy(os.environ)
|
||||
with set_environ(env_name, value):
|
||||
assert os.environ.get(env_name) == value
|
||||
|
||||
assert os.environ == environ_copy
|
||||
|
||||
|
||||
def test_set_environ_raises_exception():
|
||||
"""Tests set_environ will raise exceptions in context when the
|
||||
value parameter is None."""
|
||||
with pytest.raises(Exception) as exception:
|
||||
with set_environ('test1', None):
|
||||
raise Exception('Expected exception')
|
||||
|
||||
assert 'Expected exception' in str(exception.value)
|
||||
0
tests/testserver/__init__.py
Normal file
0
tests/testserver/__init__.py
Normal file
127
tests/testserver/server.py
Normal file
127
tests/testserver/server.py
Normal file
@@ -0,0 +1,127 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import threading
|
||||
import socket
|
||||
import select
|
||||
|
||||
|
||||
def consume_socket_content(sock, timeout=0.5):
|
||||
chunks = 65536
|
||||
content = b''
|
||||
|
||||
while True:
|
||||
more_to_read = select.select([sock], [], [], timeout)[0]
|
||||
if not more_to_read:
|
||||
break
|
||||
|
||||
new_content = sock.recv(chunks)
|
||||
if not new_content:
|
||||
break
|
||||
|
||||
content += new_content
|
||||
|
||||
return content
|
||||
|
||||
|
||||
class Server(threading.Thread):
|
||||
"""Dummy server using for unit testing"""
|
||||
WAIT_EVENT_TIMEOUT = 5
|
||||
|
||||
def __init__(self, handler=None, host='localhost', port=0, requests_to_handle=1, wait_to_close_event=None):
|
||||
super(Server, self).__init__()
|
||||
|
||||
self.handler = handler or consume_socket_content
|
||||
self.handler_results = []
|
||||
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.requests_to_handle = requests_to_handle
|
||||
|
||||
self.wait_to_close_event = wait_to_close_event
|
||||
self.ready_event = threading.Event()
|
||||
self.stop_event = threading.Event()
|
||||
|
||||
@classmethod
|
||||
def text_response_server(cls, text, request_timeout=0.5, **kwargs):
|
||||
def text_response_handler(sock):
|
||||
request_content = consume_socket_content(sock, timeout=request_timeout)
|
||||
sock.send(text.encode('utf-8'))
|
||||
|
||||
return request_content
|
||||
|
||||
|
||||
return Server(text_response_handler, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def basic_response_server(cls, **kwargs):
|
||||
return cls.text_response_server(
|
||||
"HTTP/1.1 200 OK\r\n" +
|
||||
"Content-Length: 0\r\n\r\n",
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.server_sock = self._create_socket_and_bind()
|
||||
# in case self.port = 0
|
||||
self.port = self.server_sock.getsockname()[1]
|
||||
self.ready_event.set()
|
||||
self._handle_requests()
|
||||
|
||||
if self.wait_to_close_event:
|
||||
self.wait_to_close_event.wait(self.WAIT_EVENT_TIMEOUT)
|
||||
finally:
|
||||
self.ready_event.set() # just in case of exception
|
||||
self._close_server_sock_ignore_errors()
|
||||
self.stop_event.set()
|
||||
|
||||
def _create_socket_and_bind(self):
|
||||
sock = socket.socket()
|
||||
sock.bind((self.host, self.port))
|
||||
sock.listen(0)
|
||||
return sock
|
||||
|
||||
def _close_server_sock_ignore_errors(self):
|
||||
try:
|
||||
self.server_sock.close()
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
def _handle_requests(self):
|
||||
for _ in range(self.requests_to_handle):
|
||||
sock = self._accept_connection()
|
||||
if not sock:
|
||||
break
|
||||
|
||||
handler_result = self.handler(sock)
|
||||
|
||||
self.handler_results.append(handler_result)
|
||||
|
||||
def _accept_connection(self):
|
||||
try:
|
||||
ready, _, _ = select.select([self.server_sock], [], [], self.WAIT_EVENT_TIMEOUT)
|
||||
if not ready:
|
||||
return None
|
||||
|
||||
return self.server_sock.accept()[0]
|
||||
except (select.error, socket.error):
|
||||
return None
|
||||
|
||||
def __enter__(self):
|
||||
self.start()
|
||||
self.ready_event.wait(self.WAIT_EVENT_TIMEOUT)
|
||||
return self.host, self.port
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
if exc_type is None:
|
||||
self.stop_event.wait(self.WAIT_EVENT_TIMEOUT)
|
||||
else:
|
||||
if self.wait_to_close_event:
|
||||
# avoid server from waiting for event timeouts
|
||||
# if an exception is found in the main thread
|
||||
self.wait_to_close_event.set()
|
||||
|
||||
# ensure server thread doesn't get stuck waiting for connections
|
||||
self._close_server_sock_ignore_errors()
|
||||
self.join()
|
||||
return False # allow exceptions to propagate
|
||||
19
tests/utils.py
Normal file
19
tests/utils.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def override_environ(**kwargs):
|
||||
save_env = dict(os.environ)
|
||||
for key, value in kwargs.items():
|
||||
if value is None:
|
||||
del os.environ[key]
|
||||
else:
|
||||
os.environ[key] = value
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
os.environ.clear()
|
||||
os.environ.update(save_env)
|
||||
Reference in New Issue
Block a user