source: general/prog/python-modules/requests.xml@ ab3ae35a

11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18 xry111/xf86-video-removal
Last change on this file since ab3ae35a was ab3ae35a, checked in by Ken Moffat <ken@…>, 17 months ago

python-modules: patch Requests to be able to use system certs.

  • Property mode set to 100644
File size: 6.4 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../../general.ent">
5 %general-entities;
6
7 <!ENTITY requests-download-http "https://github.com/psf/requests/releases/download/v&requests-version;/requests-&requests-version;.tar.gz">
8 <!ENTITY requests-download-ftp " ">
9 <!ENTITY requests-md5sum "796ea875cdae283529c03b9203d9c454">
10 <!ENTITY requests-size "107 KB">
11 <!ENTITY requests-buildsize "1.4 MB (add 54 MB for tests)">
12 <!ENTITY requests-time "less than 0.1 SBU (0.7 SBU for tests)">
13]>
14
15 <sect2 id="requests" xreflabel="requests-&requests-version;">
16
17 <title>Requests-&requests-version;</title>
18
19 <indexterm zone="requests">
20 <primary sortas="a-requests">requests</primary>
21 </indexterm>
22
23 <sect3 role="package">
24 <title>Introduction to Requests Module</title>
25
26 <para>
27 The <application>Requests</application> package is an elegant and
28 simple HTTP library for Python, built for human beings. It allows
29 sending HTTP/1.1 requests extremely easily.
30 </para>
31
32 &lfs112_checked;
33
34 <bridgehead renderas="sect4">Package Information</bridgehead>
35 <itemizedlist spacing="compact">
36 <listitem>
37 <para>
38 Download (HTTP): <ulink url="&requests-download-http;"/>
39 </para>
40 </listitem>
41 <listitem>
42 <para>
43 Download (FTP): <ulink url="&requests-download-ftp;"/>
44 </para>
45 </listitem>
46 <listitem>
47 <para>
48 Download MD5 sum: &requests-md5sum;
49 </para>
50 </listitem>
51 <listitem>
52 <para>
53 Download size: &requests-size;
54 </para>
55 </listitem>
56 <listitem>
57 <para>
58 Estimated disk space required: &requests-buildsize;
59 </para>
60 </listitem>
61 <listitem>
62 <para>
63 Estimated build time: &requests-time;
64 </para>
65 </listitem>
66 </itemizedlist>
67
68 <bridgehead renderas="sect3">Recommended Additional Download</bridgehead>
69 <itemizedlist spacing="compact">
70 <listitem>
71 <para>
72 Recommended patch: <ulink
73 url="&patch-root;/requests-&requests-version;-use_system_certs-1.patch"/>
74 </para>
75 </listitem>
76 </itemizedlist>
77 <bridgehead renderas="sect4">Requests Dependencies</bridgehead>
78
79 <bridgehead renderas="sect5">Required</bridgehead>
80 <para role="required">
81 <xref linkend="charset-normalizer"/>,
82 <xref linkend="idna"/>, and
83 <xref linkend="urllib3"/>
84 </para>
85
86 <bridgehead renderas="sect5">Recommended</bridgehead>
87 <para role="recommended">
88 <xref linkend="make-ca"/>, with
89 <xref linkend="p11-kit"/> (both needed to use system https: certificates,
90 removing an unnecessary dependency on the <application>Certifi</application>
91 module).
92 </para>
93
94 <bridgehead renderas="sect5">Optional</bridgehead>
95 <para role="optional">
96 <ulink url="https://pypi.org/project/PySocks/">PySocks</ulink> (also needed for testing)
97 </para>
98
99 <bridgehead renderas="sect5">Optional (for testing)</bridgehead>
100 <para role="optional">
101 <xref linkend="pytest"/>,
102 <ulink url="https://pypi.org/project/Flask/">Flask</ulink>&lt;2,
103 <ulink url="https://pypi.org/project/httpbin/">httpbin</ulink>,
104 <ulink url="https://pypi.org/project/MarkupSafe/">MarkupSafe</ulink>&lt;2.1,
105 <ulink url="https://pypi.org/project/pytest-mock/">pytest-mock</ulink>,
106 <ulink url="https://pypi.org/project/pytest-httpbin/">pytest-httpbin</ulink>,
107 <ulink url="https://pypi.org/project/trustme/">trustme</ulink>, and
108 <ulink url="https://pypi.org/project/Werkzeug/">Werkzeug</ulink>&lt;2
109 </para>
110
111 </sect3>
112
113 <sect3 role="installation">
114 <title>Installation of Requests</title>
115
116 <para>
117 First apply a patch so that the same environment variable already used to
118 point to system certificates in <application>Python3</application> following
119 the installation of <application>make-ca</application> can also be used by
120 this module:
121 </para>
122
123<screen><userinput>patch -Np1 -i ../requests-&requests-version;-use_system_certs-1.patch</userinput></screen>
124
125 <para> Build the module: </para>
126
127<screen><userinput>pip3 wheel -w dist --no-build-isolation --no-deps $PWD</userinput></screen>
128
129 <para>
130 Now, as the <systemitem class="username">root</systemitem> user:
131 </para>
132
133<screen role="root"><userinput>pip3 install --no-index --find-links dist --no-cache-dir --no-user requests</userinput></screen>
134
135 <para>
136 Assuming <xref linkend="pytest"/> is installed, but the other optional
137 dependencies are not, the installation can be tested with the following
138 commands:
139 </para>
140
141<screen remap="test"><userinput>python3 -m venv --system-site-packages testenv &amp;&amp;
142source testenv/bin/activate &amp;&amp;
143pip3 install pytest-mock \
144 werkzeug\&lt;2 \
145 flask\&lt;2 \
146 pytest-httpbin \
147 pysocks \
148 trustme &amp;&amp;
149pip3 install --force-reinstall Markupsafe\&lt;2.1 &amp;&amp;
150python3 /usr/bin/pytest tests &amp;&amp;
151deactivate</userinput></screen>
152
153 <note>
154 <para>
155 See <xref linkend="make-ca"/> for how to set the environment variable,
156 and for how local copies of the Certifi and Requests modules installed
157 in a virtual environment <emphasis>will</emphasis> override the system
158 certificates.
159 </para>
160 </note>
161
162 </sect3>
163
164 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
165 href="../../../xincludes/pip3-cmd-explain.xml"/>
166
167 <sect3 role="content">
168 <title>Contents</title>
169
170 <segmentedlist>
171 <segtitle>Installed Programs</segtitle>
172 <segtitle>Installed Libraries</segtitle>
173 <segtitle>Installed Directories</segtitle>
174
175 <seglistitem>
176 <seg>None</seg>
177 <seg>None</seg>
178 <seg>
179 /usr/lib/python&python3-majorver;/site-packages/requests and
180 /usr/lib/python&python3-majorver;/site-packages/requests-&requests-version;.dist-info
181 </seg>
182 </seglistitem>
183 </segmentedlist>
184
185 </sect3>
186
187 </sect2>
Note: See TracBrowser for help on using the repository browser.