[ab4fdfc] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
[0cf85fa] | 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 |
|
---|
[8f65da99] | 7 | <!ENTITY requests-download-http "https://files.pythonhosted.org/packages/source/r/requests/requests-&requests-version;.tar.gz">
|
---|
[432ea40] | 8 | <!ENTITY requests-download-ftp " ">
|
---|
[569925c7] | 9 | <!ENTITY requests-md5sum "&requests-md5sum;">
|
---|
[4b8c5140] | 10 | <!ENTITY requests-size "132 KB">
|
---|
[6772fef] | 11 | <!ENTITY requests-buildsize "1.1 MB (add 139 MB for tests)">
|
---|
[4b8c5140] | 12 | <!ENTITY requests-time "less than 0.1 SBU (0.9 SBU for tests)">
|
---|
[0cf85fa] | 13 | ]>
|
---|
| 14 |
|
---|
[432ea40] | 15 | <sect2 id="requests" xreflabel="requests-&requests-version;">
|
---|
[0cf85fa] | 16 |
|
---|
[432ea40] | 17 | <title>Requests-&requests-version;</title>
|
---|
[0cf85fa] | 18 |
|
---|
[432ea40] | 19 | <indexterm zone="requests">
|
---|
| 20 | <primary sortas="a-requests">requests</primary>
|
---|
[0cf85fa] | 21 | </indexterm>
|
---|
| 22 |
|
---|
| 23 | <sect3 role="package">
|
---|
[432ea40] | 24 | <title>Introduction to Requests Module</title>
|
---|
[0cf85fa] | 25 |
|
---|
| 26 | <para>
|
---|
[432ea40] | 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.
|
---|
[0cf85fa] | 30 | </para>
|
---|
| 31 |
|
---|
[09ddf35a] | 32 | &lfs122_checked;
|
---|
[0cf85fa] | 33 |
|
---|
| 34 | <bridgehead renderas="sect4">Package Information</bridgehead>
|
---|
| 35 | <itemizedlist spacing="compact">
|
---|
| 36 | <listitem>
|
---|
| 37 | <para>
|
---|
[432ea40] | 38 | Download (HTTP): <ulink url="&requests-download-http;"/>
|
---|
[0cf85fa] | 39 | </para>
|
---|
| 40 | </listitem>
|
---|
| 41 | <listitem>
|
---|
| 42 | <para>
|
---|
[432ea40] | 43 | Download (FTP): <ulink url="&requests-download-ftp;"/>
|
---|
[0cf85fa] | 44 | </para>
|
---|
| 45 | </listitem>
|
---|
| 46 | <listitem>
|
---|
| 47 | <para>
|
---|
[432ea40] | 48 | Download MD5 sum: &requests-md5sum;
|
---|
[0cf85fa] | 49 | </para>
|
---|
| 50 | </listitem>
|
---|
| 51 | <listitem>
|
---|
| 52 | <para>
|
---|
[432ea40] | 53 | Download size: &requests-size;
|
---|
[0cf85fa] | 54 | </para>
|
---|
| 55 | </listitem>
|
---|
| 56 | <listitem>
|
---|
| 57 | <para>
|
---|
[432ea40] | 58 | Estimated disk space required: &requests-buildsize;
|
---|
[0cf85fa] | 59 | </para>
|
---|
| 60 | </listitem>
|
---|
| 61 | <listitem>
|
---|
| 62 | <para>
|
---|
[432ea40] | 63 | Estimated build time: &requests-time;
|
---|
[0cf85fa] | 64 | </para>
|
---|
| 65 | </listitem>
|
---|
| 66 | </itemizedlist>
|
---|
| 67 |
|
---|
[1076135] | 68 | <bridgehead renderas="sect4">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 |
|
---|
[432ea40] | 78 | <bridgehead renderas="sect4">Requests Dependencies</bridgehead>
|
---|
[0cf85fa] | 79 |
|
---|
[432ea40] | 80 | <bridgehead renderas="sect5">Required</bridgehead>
|
---|
| 81 | <para role="required">
|
---|
| 82 | <xref linkend="charset-normalizer"/>,
|
---|
| 83 | <xref linkend="idna"/>, and
|
---|
| 84 | <xref linkend="urllib3"/>
|
---|
[0cf85fa] | 85 | </para>
|
---|
| 86 |
|
---|
[ab3ae35a] | 87 | <bridgehead renderas="sect5">Recommended</bridgehead>
|
---|
| 88 | <para role="recommended">
|
---|
| 89 | <xref linkend="make-ca"/>, with
|
---|
| 90 | <xref linkend="p11-kit"/> (both needed to use system https: certificates,
|
---|
| 91 | removing an unnecessary dependency on the <application>Certifi</application>
|
---|
| 92 | module).
|
---|
| 93 | </para>
|
---|
| 94 |
|
---|
[114f6db9] | 95 | <bridgehead renderas="sect5">Optional</bridgehead>
|
---|
| 96 | <para role="optional">
|
---|
| 97 | <ulink url="https://pypi.org/project/PySocks/">PySocks</ulink> (also needed for testing)
|
---|
| 98 | </para>
|
---|
| 99 |
|
---|
| 100 | <bridgehead renderas="sect5">Optional (for testing)</bridgehead>
|
---|
| 101 | <para role="optional">
|
---|
| 102 | <xref linkend="pytest"/>,
|
---|
| 103 | <ulink url="https://pypi.org/project/Flask/">Flask</ulink><2,
|
---|
| 104 | <ulink url="https://pypi.org/project/httpbin/">httpbin</ulink>,
|
---|
| 105 | <ulink url="https://pypi.org/project/MarkupSafe/">MarkupSafe</ulink><2.1,
|
---|
| 106 | <ulink url="https://pypi.org/project/pytest-mock/">pytest-mock</ulink>,
|
---|
| 107 | <ulink url="https://pypi.org/project/pytest-httpbin/">pytest-httpbin</ulink>,
|
---|
[b112f043] | 108 | <ulink url="https://pypi.org/project/sphinx/">sphinx</ulink><5,
|
---|
[114f6db9] | 109 | <ulink url="https://pypi.org/project/trustme/">trustme</ulink>, and
|
---|
| 110 | <ulink url="https://pypi.org/project/Werkzeug/">Werkzeug</ulink><2
|
---|
| 111 | </para>
|
---|
| 112 |
|
---|
[0cf85fa] | 113 | </sect3>
|
---|
| 114 |
|
---|
| 115 | <sect3 role="installation">
|
---|
[432ea40] | 116 | <title>Installation of Requests</title>
|
---|
[0cf85fa] | 117 |
|
---|
[ab3ae35a] | 118 | <para>
|
---|
| 119 | First apply a patch so that the same environment variable already used to
|
---|
| 120 | point to system certificates in <application>Python3</application> following
|
---|
| 121 | the installation of <application>make-ca</application> can also be used by
|
---|
| 122 | this module:
|
---|
| 123 | </para>
|
---|
| 124 |
|
---|
| 125 | <screen><userinput>patch -Np1 -i ../requests-&requests-version;-use_system_certs-1.patch</userinput></screen>
|
---|
| 126 |
|
---|
[9f2364e] | 127 | <para>Build the module: </para>
|
---|
[0cf85fa] | 128 |
|
---|
[db244ae2] | 129 | &build-wheel;
|
---|
[0cf85fa] | 130 |
|
---|
| 131 | <para>
|
---|
[114f6db9] | 132 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
[0cf85fa] | 133 | </para>
|
---|
| 134 |
|
---|
[db244ae2] | 135 | <screen role="root"><userinput>&install-wheel; requests</userinput></screen>
|
---|
[114f6db9] | 136 |
|
---|
[0cf85fa] | 137 | <para>
|
---|
[114f6db9] | 138 | Assuming <xref linkend="pytest"/> is installed, but the other optional
|
---|
| 139 | dependencies are not, the installation can be tested with the following
|
---|
| 140 | commands:
|
---|
[0cf85fa] | 141 | </para>
|
---|
| 142 |
|
---|
[114f6db9] | 143 | <screen remap="test"><userinput>python3 -m venv --system-site-packages testenv &&
|
---|
| 144 | source testenv/bin/activate &&
|
---|
[b112f043] | 145 | pip3 install --force-reinstall sphinx\<5 &&
|
---|
[114f6db9] | 146 | pip3 install pytest-mock \
|
---|
| 147 | werkzeug\<2 \
|
---|
| 148 | flask\<2 \
|
---|
| 149 | pytest-httpbin \
|
---|
| 150 | pysocks \
|
---|
| 151 | trustme &&
|
---|
| 152 | pip3 install --force-reinstall Markupsafe\<2.1 &&
|
---|
[9f2364e] | 153 | python3 /usr/bin/pytest tests
|
---|
[114f6db9] | 154 | deactivate</userinput></screen>
|
---|
[0cf85fa] | 155 |
|
---|
[ab3ae35a] | 156 | <note>
|
---|
| 157 | <para>
|
---|
| 158 | See <xref linkend="make-ca"/> for how to set the environment variable,
|
---|
| 159 | and for how local copies of the Certifi and Requests modules installed
|
---|
| 160 | in a virtual environment <emphasis>will</emphasis> override the system
|
---|
| 161 | certificates.
|
---|
| 162 | </para>
|
---|
| 163 | </note>
|
---|
| 164 |
|
---|
[0cf85fa] | 165 | </sect3>
|
---|
| 166 |
|
---|
| 167 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
| 168 | href="../../../xincludes/pip3-cmd-explain.xml"/>
|
---|
| 169 |
|
---|
| 170 | <sect3 role="content">
|
---|
| 171 | <title>Contents</title>
|
---|
| 172 |
|
---|
| 173 | <segmentedlist>
|
---|
| 174 | <segtitle>Installed Programs</segtitle>
|
---|
| 175 | <segtitle>Installed Libraries</segtitle>
|
---|
| 176 | <segtitle>Installed Directories</segtitle>
|
---|
| 177 |
|
---|
| 178 | <seglistitem>
|
---|
[432ea40] | 179 | <seg>None</seg>
|
---|
[0cf85fa] | 180 | <seg>None</seg>
|
---|
| 181 | <seg>
|
---|
[432ea40] | 182 | /usr/lib/python&python3-majorver;/site-packages/requests and
|
---|
| 183 | /usr/lib/python&python3-majorver;/site-packages/requests-&requests-version;.dist-info
|
---|
[0cf85fa] | 184 | </seg>
|
---|
| 185 | </seglistitem>
|
---|
| 186 | </segmentedlist>
|
---|
[54d58907] | 187 |
|
---|
[0cf85fa] | 188 | </sect3>
|
---|
| 189 |
|
---|
| 190 | </sect2>
|
---|