url信封,将原始链接放在信封内,可以安全的在get请求中传输,在接收到后打开还原请求链接
Project description
该项目用于将url经过base64转码后可以安全的在http请求参数中传输
encode-decode 过程
原始链接的encode和decode对应方法
from longbao_urllib import UrlEnvelop
import time
host = "http://localhost:8000"
# 创建一个url信封,compress用于对参数进行压缩
wrapper = UrlEnvelop(
f"{host}/api/ad/callback?q1=123&q2=234&q3=456&q4=78911",
compress=True,
)
# 返回可以放在query中的参数
raw = wrapper.url_encode(
f"{host}/api/ad/mock/kuaishou/callback?cid=123&pid=xyzxxxxxxxxxxxxxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyyyyxxxxxxxxxxxxxxxxxxxxxxxx",
clickid="xx-yy-zz")
decoded_url = wrapper.url_decode(raw, conv_type=1, conv_ts=time.time(), clickid="xx-yy-zz")
参数 wrap-upwrap 过程
from longbao_urllib import UrlEnvelop
host = "http://localhost:8000"
wrapper = UrlEnvelop(
f"{host}/api/ad/callback?q1=123&q2=234&q3=456&q4=78911",
compress=True,
)
# 将原始链接包裹后的新的链接
url1 = wrapper.wrap(
f"{host}/api/ad/mock/kuaishou/callback?callback=123&pid=xyz",
request_id="xx-yy-zz",
)
# 打开后返回原始的链接
url2 = wrapper.unwrap(
url1,
request_id="xx-yy-ww",
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
longbao_urllib-0.2.0.tar.gz
(4.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file longbao_urllib-0.2.0.tar.gz.
File metadata
- Download URL: longbao_urllib-0.2.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d34a45e54f50e04a87ae85bc2c2df0d8e95af57e0b7d489eca2f5706a94780a2
|
|
| MD5 |
0b3f69c9906dd7d6a84a4db0a6d9144f
|
|
| BLAKE2b-256 |
2ad303b4a8149053eb8b5b2345f89eb8b984c1152a7cf9264eef5b4eff61602a
|
File details
Details for the file longbao_urllib-0.2.0-py3-none-any.whl.
File metadata
- Download URL: longbao_urllib-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ed05bd3bcfe40d3da1daf4727a9c546658230c7f3402e5c13594c5e5dc7814c
|
|
| MD5 |
59d732956bce3b6ab524735ae3785fd1
|
|
| BLAKE2b-256 |
beacdefbd1ba363fa28481247c073bb951f02031739c0d550776b93fbda605d3
|