Skip to main content

http请求工具

Project description

使用手册

快速开始

import httper

params = {
    "a": 1,
    "b": 2
}

# 发送get请求
httper.get("http://localhost:8080/test/get?id=1")
httper.get("http://localhost:8080/test/get?id=1", params)
httper.get("http://localhost:8080/test/get?id=1", params=params, timeout=10, headers={})

# 发送post请求
httper.post("http://localhost:8080/test/post?id=1")
httper.post("http://localhost:8080/test/post?id=1", params)
httper.post("http://localhost:8080/test/post?id=1", params=params, timeout=10, headers={})

# 发送post表单请求
httper.postForm("http://localhost:8080/test/postForm?id=1", params)
httper.postForm("http://localhost:8080/test/postForm?id=1", form=params, timeout=10, headers={})

# 下载文件
httper.getFile("http://localhost:8080/test/getFile?id=1", "test.py")
httper.getFile("http://localhost:8080/test/getFile?id=1", "test.py", progress=True)

httper.postFile("http://localhost:8080/test/postFile?id=1", "test.py")
httper.postFile("http://localhost:8080/test/postFile?id=1", "test.py", progress=True)

httper.downloadFile("http://localhost:8080/test/downloadFile?id=1", "test.py")
httper.downloadFile("http://localhost:8080/test/downloadFile?id=1", "test.py", progress=True)

# 上传文件
httper.uploadFile("http://localhost:8080/test/uploadFile?id=1", "file1", "./files/test.py")
httper.uploadFile("http://localhost:8080/test/uploadFile?id=1", "file1", open("./files/test.py"))
httper.uploadFile("http://localhost:8080/test/uploadFile?id=1", name="file1", file="[fileBytes]", fname="test.py")
httper.uploadFile("http://localhost:8080/test/uploadFile?id=1", name="file1",
                  file=("", open("./files/test.py", "rb"), "image/jpeg", {"refer": "localhost"}))
httper.uploadFile("http://localhost:8080/test/uploadFile?id=1", name="file1",
                  file=("new_filename.py", open("./files/test.py", "rb"), "image/jpeg", {"refer": "localhost"}))

httper.uploadImage("http://localhost:8080/test/uploadImage?id=1", "file2", "./files/img1.py")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

httper-0.0.1.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distributions

httper-0.0.1-py3.9.egg (6.4 kB view hashes)

Uploaded Source

httper-0.0.1-py2.py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page