Geegeng Python API Client
Project description
geegeng
Geegeng Python API 客户端。
安装
pip install geegeng
快速开始
from geegeng import GeegengClient
# 创建客户端并登录
client = GeegengClient(phone="your_phone", password="your_password")
client.login()
# 获取用户信息
user_info = client.get_user_info()
print(user_info)
# 列出文件
files = client.list_files()
print(files)
也可以使用便捷函数一步创建并登录:
from geegeng import create_client
client = create_client(phone="your_phone", password="your_password")
功能
文件管理
# 列出根目录文件
files = client.list_files(parent_id=-1)
# 搜索文件
results = client.search_files(keyword="video")
# 创建文件夹
client.create_folder(name="新文件夹", parent_id=-1)
# 删除文件
client.delete_files(file_ids=["file_id_1", "file_id_2"])
下载文件
# 获取下载链接
url = client.get_download_url(file_id="your_file_id")
# 下载文件(支持进度回调)
def on_progress(downloaded, total):
print(f"{downloaded / total * 100:.1f}%")
client.download_file(
url=url,
save_path="./downloads",
progress_callback=on_progress,
)
上传文件
# 上传文件(自动尝试秒传)
def on_progress(stage, current, total):
if stage == "md5":
print(f"计算 MD5: {current / total * 100:.1f}%")
elif stage == "upload":
print(f"上传中: {current / total * 100:.1f}%")
elif stage == "complete":
print("上传完成!")
result = client.upload_file(
file_path="./video.mp4",
parent_id=-1,
progress_callback=on_progress,
)
分享功能
# 创建分享链接
share = client.create_share(file_ids=["file_id"], days=7)
# 获取分享信息
info = client.get_share_info(share_id="share_id", share_pwd="password")
上下文管理器
with GeegengClient(phone="your_phone", password="your_password") as client:
client.login()
files = client.list_files()
# 自动关闭连接
异常处理
from geegeng import GeegengAuthError, GeegengAPIError
try:
client.login()
except GeegengAuthError as e:
print(f"登录失败: {e}")
except GeegengAPIError as e:
print(f"API 错误: {e}")
License
MIT
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
geegeng-0.0.1.tar.gz
(10.4 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
geegeng-0.0.1-py3-none-any.whl
(11.3 kB
view details)
File details
Details for the file geegeng-0.0.1.tar.gz.
File metadata
- Download URL: geegeng-0.0.1.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be83e52096e44e729c718d79d273dbc6573d2514cadcba528e11c64602802351
|
|
| MD5 |
19f54288eaa8220af9c4459e769d6960
|
|
| BLAKE2b-256 |
d3acfb3e172e2d929ecfaea0e15eedf2a9065894cda436723bad6bb0a025d2fc
|
File details
Details for the file geegeng-0.0.1-py3-none-any.whl.
File metadata
- Download URL: geegeng-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db98338ddeb1b7e8f0c188324af5a460e9f35bf68cc5b15272e5818b1e0d0ad2
|
|
| MD5 |
bdb6bc908abe0f36611e9c7ce8848a93
|
|
| BLAKE2b-256 |
b1ef7c000b2780b62081f4830b7327529399ba6a14abd2a916b0dcf63ff875c7
|