ezKit 1.11.15__tar.gz → 1.11.16__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {ezkit-1.11.15/ezKit.egg-info → ezkit-1.11.16}/PKG-INFO +1 -1
- ezkit-1.11.16/ezKit/dockerhub.py +48 -0
- {ezkit-1.11.15 → ezkit-1.11.16/ezKit.egg-info}/PKG-INFO +1 -1
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit.egg-info/SOURCES.txt +1 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/setup.py +1 -1
- {ezkit-1.11.15 → ezkit-1.11.16}/LICENSE +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/MANIFEST.in +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/README.md +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/__init__.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/_file.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/bottle.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/bottle_extensions.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/cipher.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/database.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/http.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/markdown_to_html.template +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/mongo.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/qywx.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/redis.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/sendemail.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/token.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/utils.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit/xftp.py +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit.egg-info/dependency_links.txt +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit.egg-info/requires.txt +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/ezKit.egg-info/top_level.txt +0 -0
- {ezkit-1.11.15 → ezkit-1.11.16}/setup.cfg +0 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
"""Docker Hub"""
|
2
|
+
import requests
|
3
|
+
from loguru import logger
|
4
|
+
|
5
|
+
|
6
|
+
def get_latest_tags(url: str, limit: int = 20, proxies: dict | None = None) -> list | None:
|
7
|
+
|
8
|
+
info: str = "获取最新标签"
|
9
|
+
|
10
|
+
try:
|
11
|
+
|
12
|
+
logger.info(f"{info} [begin]")
|
13
|
+
|
14
|
+
# url = "https://hub.docker.com/v2/repositories/library/postgres/tags"
|
15
|
+
|
16
|
+
# 配置代理
|
17
|
+
# proxies = {
|
18
|
+
# "http": "http://127.0.0.1:1087",
|
19
|
+
# "https": "http://127.0.0.1:1087",
|
20
|
+
# }
|
21
|
+
|
22
|
+
# 请求接口
|
23
|
+
response = requests.get(url, params={"page": 1, "page_size": limit}, proxies=proxies, timeout=10)
|
24
|
+
|
25
|
+
# 检查请求状态码
|
26
|
+
if response.status_code != 200:
|
27
|
+
logger.error(f"{info} [请求接口错误, 状态码: {response.status_code}]")
|
28
|
+
return None
|
29
|
+
|
30
|
+
# 转换格式
|
31
|
+
data: dict = response.json()
|
32
|
+
|
33
|
+
results = data.get("results")
|
34
|
+
|
35
|
+
if results is None:
|
36
|
+
logger.error(f"{info} [请求结果错误]")
|
37
|
+
return None
|
38
|
+
|
39
|
+
# 提取 tags
|
40
|
+
tags = [tag["name"] for tag in results]
|
41
|
+
|
42
|
+
logger.success(f"{info} [success]")
|
43
|
+
return tags
|
44
|
+
|
45
|
+
except Exception as e:
|
46
|
+
logger.error(f"{info} [error]")
|
47
|
+
logger.exception(e)
|
48
|
+
return None
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|