Skip to main content

re_it 中文的python网络请求库!

如果程序错了,请报告给534047068@qq.com。


快捷输入
输入首字母快速输入,不用切换输入法。
(我用的pycharm)


你可以按照以下步骤使用这个包,并在代码中添加注释以更好地理解其功能和用法: 导入 re_it 模块:from re_it import 请求
创建一个请求对象实例:

我的请求实例 = 请求.我的请求()

使用 添加头部() 方法为请求添加头部信息(有默认请求头):

我的请求实例.添加头部('User-Agent', 'Mozilla/5.0')  # 添加User-Agent头部信息
我的请求实例.添加头部('Content-Type', 'application/json')  # 添加Authorization头部信息

发送 GET 请求并获取响应内容:

网址 = "www.example.com"  # 设置目标网址
响应内容 = 我的请求实例.获取(网址)  # 发送GET请求并获取响应内容
print(响应内容)  # 打印响应内容

发送 POST 请求并获取响应内容:

网址 = "www.example.com"  # 设置目标网址
数据 = "key1=value1&key2=value2"  # 设置POST请求的数据,可选参数
响应内容 = 我的请求实例.提交(网址, 数据)  # 发送POST请求并获取响应内容
print(响应内容)  # 打印响应内容

输出:

<!doctype html>
<html>
<head>
    <title>Example Domain</title>

    <meta charset="utf-8" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style type="text/css">
    body {
        background-color: #f0f0f2;
        margin: 0;
        padding: 0;
        font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;

    }
    div {
        width: 600px;
        margin: 5em auto;
        padding: 2em;
        background-color: #fdfdff;
        border-radius: 0.5em;
        box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
    }
    a:link, a:visited {
        color: #38488f;
        text-decoration: none;
    }
    @media (max-width: 700px) {
        div {
            margin: 0 auto;
            width: auto;
        }
    }
    </style>    
</head>

<body>
<div>
    <h1>Example Domain</h1>
    <p>This domain is for use in illustrative examples in documents. You may use this
    domain in literature without prior coordination or asking for permission.</p>
    <p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>

<!doctype html>
<html>
<head>
    <title>Example Domain</title>

    <meta charset="utf-8" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style type="text/css">
    body {
        background-color: #f0f0f2;
        margin: 0;
        padding: 0;
        font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;

    }
    div {
        width: 600px;
        margin: 5em auto;
        padding: 2em;
        background-color: #fdfdff;
        border-radius: 0.5em;
        box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
    }
    a:link, a:visited {
        color: #38488f;
        text-decoration: none;
    }
    @media (max-width: 700px) {
        div {
            margin: 0 auto;
            width: auto;
        }
    }
    </style>    
</head>

<body>
<div>
    <h1>Example Domain</h1>
    <p>This domain is for use in illustrative examples in documents. You may use this
    domain in literature without prior coordination or asking for permission.</p>
    <p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>

这个网络请求包中的函数有一些可选参数和必选参数。下面是每个函数的参数说明:
添加头部(self, 键, 值) 函数:

必选参数:

  • 键:要添加到请求头部的键。
  • 值:要添加到请求头部的值。
    获取(self, 网址) 函数:

必选参数:

  • 网址:目标网址,用于建立连接并发送 GET 请求。
    提交(self, 网址, 数据=None) 函数:

必选参数:

  • 网址:目标网址,用于建立连接并发送 POST 请求。
    可选参数:
  • 数据:POST 请求的数据,使用 URL 编码格式(例如,"key1=value1&key2=value2")。默认值为 None,即没有请求数据。

    所有的函数都是在一个名为 "我的请求" 的类中定义的,并且都需要通过类的实例进行调用(如 请求.函数名())。

需要注意的是,根据具体的使用情况,你可能需要根据需要自定义请求头部信息和请求数据,并根据目标网址发送相应的请求。


version : 1.0.0.0

Metadata

Release files for re-it 1.1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for re-it 1.1.1.0
File Size Uploaded Provenance Actions
re_it-1.1.1.0.tar.gz 3.3 kB Without provenance Details for re_it-1.1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for re-it 1.1.1.0
File Interpreter ABI Platform Actions
re_it-1.1.1.0-py3-none-any.whl Python 3 none any Details for re_it-1.1.1.0-py3-none-any.whl

Total release size: 6.9 kB

Release files / re_it-1.1.1.0.tar.gz

Download URL re_it-1.1.1.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6cbffb50b9c80e35194d49b108de262a076108936c82fd60bc99855c4fa4d77b
BLAKE2b-256 checksum
How to use checksums
e3d6858cfde259643b084a875b581cfc000eb8803b250f33a0c17d62a7857971
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.6

Release files / re_it-1.1.1.0-py3-none-any.whl

Download URL re_it-1.1.1.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e2a48cc719111302e7f5c4144b1f809e87f8241e04ade95dc8eee3d09ecdca0
BLAKE2b-256 checksum
How to use checksums
6073f93f33f1fd5e94f7289f1f20089ed2433693f1b744b017fbaf230184b0ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.6

Security for re-it 1.1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page