anything-helper 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anything_helper-1.0.0/PKG-INFO +28 -0
- anything_helper-1.0.0/README.md +19 -0
- anything_helper-1.0.0/pyproject.toml +34 -0
- anything_helper-1.0.0/src/anything_helper/__init__.py +9 -0
- anything_helper-1.0.0/src/anything_helper/date_helper/__init__.py +3 -0
- anything_helper-1.0.0/src/anything_helper/date_helper/date_format.py +29 -0
- anything_helper-1.0.0/src/anything_helper/greet.py +2 -0
- anything_helper-1.0.0/src/anything_helper/http_helper/__init__.py +3 -0
- anything_helper-1.0.0/src/anything_helper/http_helper/request_get.py +30 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: anything-helper
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: 这是一个万能助手
|
|
5
|
+
Requires-Python: >=3.14
|
|
6
|
+
Requires-Dist: aiohttp>=3.14.5
|
|
7
|
+
Requires-Dist: httpx>=0.28.1
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
这是一个万能助手
|
|
11
|
+
|
|
12
|
+
## 安装
|
|
13
|
+
|
|
14
|
+
pip install anything-helper
|
|
15
|
+
|
|
16
|
+
## 使用
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from anything_helper import aiohttp_get
|
|
20
|
+
|
|
21
|
+
async def test():
|
|
22
|
+
resp = await aiohttp_get("https://www.baidu.com")
|
|
23
|
+
print(resp)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 注意点
|
|
27
|
+
|
|
28
|
+
xxx
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 构建系统配置
|
|
2
|
+
[build-system]
|
|
3
|
+
# 使用什么构建后端来构建, 包含哪些包
|
|
4
|
+
requires = ["hatchling"]
|
|
5
|
+
# 构建后端的入口模块
|
|
6
|
+
build-backend = "hatchling.build"
|
|
7
|
+
|
|
8
|
+
# 工程描述
|
|
9
|
+
[project]
|
|
10
|
+
# 发行版名称(库名、安装名)
|
|
11
|
+
name = "anything-helper"
|
|
12
|
+
# 库的当前版本
|
|
13
|
+
version = "1.0.0"
|
|
14
|
+
# 库的描述
|
|
15
|
+
description = "这是一个万能助手"
|
|
16
|
+
# 使用该库所需的python版本
|
|
17
|
+
requires-python = ">=3.14"
|
|
18
|
+
# 说明文件位置
|
|
19
|
+
readme = "README.md"
|
|
20
|
+
# 库所依赖的第三方库
|
|
21
|
+
dependencies = [
|
|
22
|
+
"aiohttp>=3.14.5",
|
|
23
|
+
"httpx>=0.28.1"
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
# 第三方配置
|
|
27
|
+
# hatchling在构建sdist包时的配置
|
|
28
|
+
[tool.hatch.build.targets.sdist]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# hatchling在构建wheel包时的配置
|
|
32
|
+
[tool.hatch.build.targets.wheel]
|
|
33
|
+
# 指定哪些包要构建到wheel包中
|
|
34
|
+
packages = ["src/anything_helper"]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def format_timestamp1(t: float) -> str:
|
|
5
|
+
"""
|
|
6
|
+
格式化时间戳
|
|
7
|
+
|
|
8
|
+
参数:
|
|
9
|
+
t 时间戳, 秒
|
|
10
|
+
返回值:
|
|
11
|
+
格式化之后的字符串
|
|
12
|
+
"""
|
|
13
|
+
obj = time.localtime(t)
|
|
14
|
+
f_str = f"{obj.tm_year}/{obj.tm_mon}/{obj.tm_mday} {obj.tm_hour}:{obj.tm_min}:{obj.tm_sec}"
|
|
15
|
+
return f_str
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def format_timestamp2(t: float) -> str:
|
|
19
|
+
"""
|
|
20
|
+
格式化时间戳
|
|
21
|
+
|
|
22
|
+
参数:
|
|
23
|
+
t 时间戳, 秒
|
|
24
|
+
返回值:
|
|
25
|
+
格式化之后的字符串
|
|
26
|
+
"""
|
|
27
|
+
obj = time.localtime(t)
|
|
28
|
+
f_str = f"{obj.tm_year}年{obj.tm_mon}月{obj.tm_mday}日 {obj.tm_hour}时{obj.tm_min}分{obj.tm_sec}秒"
|
|
29
|
+
return f_str
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import aiohttp
|
|
2
|
+
import httpx
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
async def aiohttp_get(url: str) -> str:
|
|
6
|
+
"""
|
|
7
|
+
通过aiohttp发送GET请求
|
|
8
|
+
|
|
9
|
+
参数:
|
|
10
|
+
url 请求路径
|
|
11
|
+
返回值:
|
|
12
|
+
响应文本
|
|
13
|
+
"""
|
|
14
|
+
async with aiohttp.ClientSession() as session:
|
|
15
|
+
async with session.get(url) as response:
|
|
16
|
+
return await response.text()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
async def httpx_get(url: str) -> str:
|
|
20
|
+
"""
|
|
21
|
+
通过httpx发送GET请求
|
|
22
|
+
|
|
23
|
+
参数:
|
|
24
|
+
url 请求路径
|
|
25
|
+
返回值:
|
|
26
|
+
响应文本
|
|
27
|
+
"""
|
|
28
|
+
async with httpx.AsyncClient() as client:
|
|
29
|
+
response = await client.get(url)
|
|
30
|
+
return response.text
|