met-share 1.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.
- met_share-1.0/PKG-INFO +11 -0
- met_share-1.0/README.md +0 -0
- met_share-1.0/pyproject.toml +62 -0
- met_share-1.0/pyproject.toml.orig +58 -0
- met_share-1.0/src/met_share/__init__.py +119 -0
- met_share-1.0/src/met_share/_client.py +666 -0
- met_share-1.0/src/met_share/_errors.py +221 -0
- met_share-1.0/src/met_share/_history.py +172 -0
- met_share-1.0/src/met_share/_models.py +178 -0
- met_share-1.0/src/met_share/_protocol.py +342 -0
- met_share-1.0/src/met_share/_retry.py +85 -0
- met_share-1.0/src/met_share/_source.py +265 -0
- met_share-1.0/src/met_share/_stream.py +103 -0
- met_share-1.0/src/met_share/_sync.py +277 -0
- met_share-1.0/src/met_share/cli.py +572 -0
met_share-1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: met-share
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Author: Bail
|
|
6
|
+
Author-email: Bail <2915289604@qq.com>
|
|
7
|
+
Requires-Dist: httpx2[ws]>=2.16.0
|
|
8
|
+
Requires-Dist: platformdirs>=4.0
|
|
9
|
+
Requires-Python: >=3.14
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
met_share-1.0/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "met-share"
|
|
3
|
+
version = "1.0"
|
|
4
|
+
description = "Add your description here"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.14"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"httpx2[ws]>=2.16.0",
|
|
9
|
+
"platformdirs>=4.0",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[[project.authors]]
|
|
13
|
+
name = "Bail"
|
|
14
|
+
email = "2915289604@qq.com"
|
|
15
|
+
|
|
16
|
+
[project.scripts]
|
|
17
|
+
met-share = "met_share.cli:main"
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["uv_build>=0.13.7,<0.14.0"]
|
|
21
|
+
build-backend = "uv_build"
|
|
22
|
+
|
|
23
|
+
[dependency-groups]
|
|
24
|
+
dev = ["pytest>=9.2.0"]
|
|
25
|
+
|
|
26
|
+
[tool.pytest.ini_options]
|
|
27
|
+
testpaths = ["tests"]
|
|
28
|
+
markers = ["live: 需要真实网络与真实站点,默认跳过(MET_SHARE_LIVE=1 才跑)"]
|
|
29
|
+
addopts = "-m 'not live'"
|
|
30
|
+
|
|
31
|
+
[tool.ruff]
|
|
32
|
+
target-version = "py314"
|
|
33
|
+
line-length = 100
|
|
34
|
+
extend-exclude = [
|
|
35
|
+
"docs/examples",
|
|
36
|
+
"*.md",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[tool.ruff.lint]
|
|
40
|
+
select = [
|
|
41
|
+
"E",
|
|
42
|
+
"F",
|
|
43
|
+
"W",
|
|
44
|
+
"I",
|
|
45
|
+
"UP",
|
|
46
|
+
"B",
|
|
47
|
+
"SIM",
|
|
48
|
+
"RUF",
|
|
49
|
+
]
|
|
50
|
+
ignore = ["E501"]
|
|
51
|
+
|
|
52
|
+
[tool.ruff.lint.per-file-ignores]
|
|
53
|
+
"src/met_share/cli.py" = [
|
|
54
|
+
"RUF001",
|
|
55
|
+
"RUF002",
|
|
56
|
+
"RUF003",
|
|
57
|
+
]
|
|
58
|
+
"tests/test_cli.py" = [
|
|
59
|
+
"RUF001",
|
|
60
|
+
"RUF002",
|
|
61
|
+
"RUF003",
|
|
62
|
+
]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "met-share"
|
|
3
|
+
version = "1.0"
|
|
4
|
+
description = "Add your description here"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Bail", email = "2915289604@qq.com" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.14"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"httpx2[ws]>=2.16.0",
|
|
12
|
+
"platformdirs>=4.0",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[project.scripts]
|
|
16
|
+
met-share = "met_share.cli:main"
|
|
17
|
+
|
|
18
|
+
[build-system]
|
|
19
|
+
requires = ["uv_build>=0.13.7,<0.14.0"]
|
|
20
|
+
build-backend = "uv_build"
|
|
21
|
+
|
|
22
|
+
[dependency-groups]
|
|
23
|
+
dev = [
|
|
24
|
+
"pytest>=9.2.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[tool.pytest.ini_options]
|
|
28
|
+
testpaths = ["tests"]
|
|
29
|
+
markers = [
|
|
30
|
+
"live: 需要真实网络与真实站点,默认跳过(MET_SHARE_LIVE=1 才跑)",
|
|
31
|
+
]
|
|
32
|
+
addopts = "-m 'not live'"
|
|
33
|
+
|
|
34
|
+
[tool.ruff]
|
|
35
|
+
target-version = "py314"
|
|
36
|
+
line-length = 100
|
|
37
|
+
# Kept out of lint/format for two independent reasons:
|
|
38
|
+
# - docs/examples/ holds the throwaway Chinese-language protocol-probing
|
|
39
|
+
# scripts written during research. RUF001/2/3 would flag every full-width
|
|
40
|
+
# punctuation mark, and none of it ships.
|
|
41
|
+
# - the Markdown pages embed illustrative snippets whose alignment carries
|
|
42
|
+
# meaning (aligned trailing comments, deliberate blank-line placement).
|
|
43
|
+
# ruff formats fenced Python blocks inside .md, which would rewrite
|
|
44
|
+
# documentation prose as if it were source.
|
|
45
|
+
extend-exclude = ["docs/examples", "*.md"]
|
|
46
|
+
|
|
47
|
+
[tool.ruff.lint]
|
|
48
|
+
select = ["E", "F", "W", "I", "UP", "B", "SIM", "RUF"]
|
|
49
|
+
ignore = ["E501"]
|
|
50
|
+
|
|
51
|
+
[tool.ruff.lint.per-file-ignores]
|
|
52
|
+
# The CLI's user-facing strings are Chinese, so full-width punctuation is
|
|
53
|
+
# deliberate prose rather than a lookalike character. Same reasoning as the
|
|
54
|
+
# docs/examples exclusion above; RUF003 would also fire on the comment text.
|
|
55
|
+
"src/met_share/cli.py" = ["RUF001", "RUF002", "RUF003"]
|
|
56
|
+
# The CLI tests assert on the Chinese output those strings produce.
|
|
57
|
+
"tests/test_cli.py" = ["RUF001", "RUF002", "RUF003"]
|
|
58
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""met-share: a Python SDK for ClipBox pickup-code sharing.
|
|
2
|
+
|
|
3
|
+
Two ways in, deliberately different:
|
|
4
|
+
|
|
5
|
+
- :class:`MetShare` — async, explicit, any deployment. The full surface.
|
|
6
|
+
- module-level functions — synchronous, bound to the public instance. Convenience
|
|
7
|
+
for scripts; anything else is a sign to instantiate :class:`MetShare`.
|
|
8
|
+
|
|
9
|
+
A pickup code may point at a file, text, or a link. Use :func:`info` to find out
|
|
10
|
+
which before deciding how to pick it up — it never consumes an access::
|
|
11
|
+
|
|
12
|
+
from met_share import info, receive, save
|
|
13
|
+
|
|
14
|
+
meta = info("72349")
|
|
15
|
+
if meta.kind == "file":
|
|
16
|
+
save("72349", "out.pdf") # consumes 1 access
|
|
17
|
+
else:
|
|
18
|
+
print(receive("72349").content) # consumes 1 access
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
from ._client import DEFAULT_BASE, MetShare
|
|
24
|
+
from ._errors import (
|
|
25
|
+
Forbidden,
|
|
26
|
+
HashMismatch,
|
|
27
|
+
InvalidRequest,
|
|
28
|
+
MetShareError,
|
|
29
|
+
NetworkError,
|
|
30
|
+
NotAFile,
|
|
31
|
+
NotFound,
|
|
32
|
+
RateLimited,
|
|
33
|
+
ServerError,
|
|
34
|
+
SourceChanged,
|
|
35
|
+
Timeout,
|
|
36
|
+
TooLarge,
|
|
37
|
+
Unauthorized,
|
|
38
|
+
UnexpectedResponse,
|
|
39
|
+
Unsupported,
|
|
40
|
+
UploadIncomplete,
|
|
41
|
+
UploadSessionExpired,
|
|
42
|
+
)
|
|
43
|
+
from ._models import (
|
|
44
|
+
ClipKind,
|
|
45
|
+
ClipMeta,
|
|
46
|
+
DownloadResult,
|
|
47
|
+
FileClip,
|
|
48
|
+
Progress,
|
|
49
|
+
ReceivedClip,
|
|
50
|
+
ReceivedFile,
|
|
51
|
+
ReceivedLink,
|
|
52
|
+
ReceivedText,
|
|
53
|
+
SiteConfig,
|
|
54
|
+
TextClip,
|
|
55
|
+
UploadedClip,
|
|
56
|
+
)
|
|
57
|
+
from ._sync import (
|
|
58
|
+
configure,
|
|
59
|
+
info,
|
|
60
|
+
read,
|
|
61
|
+
receive,
|
|
62
|
+
save,
|
|
63
|
+
send_file,
|
|
64
|
+
send_text,
|
|
65
|
+
shared,
|
|
66
|
+
shutdown,
|
|
67
|
+
stream,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
__version__ = "0.1.0"
|
|
71
|
+
|
|
72
|
+
__all__ = [
|
|
73
|
+
"DEFAULT_BASE",
|
|
74
|
+
# models
|
|
75
|
+
"ClipKind",
|
|
76
|
+
"ClipMeta",
|
|
77
|
+
"DownloadResult",
|
|
78
|
+
"FileClip",
|
|
79
|
+
"Forbidden",
|
|
80
|
+
"HashMismatch",
|
|
81
|
+
"InvalidRequest",
|
|
82
|
+
# clients
|
|
83
|
+
"MetShare",
|
|
84
|
+
# errors
|
|
85
|
+
"MetShareError",
|
|
86
|
+
"NetworkError",
|
|
87
|
+
"NotAFile",
|
|
88
|
+
"NotFound",
|
|
89
|
+
"Progress",
|
|
90
|
+
"RateLimited",
|
|
91
|
+
"ReceivedClip",
|
|
92
|
+
"ReceivedFile",
|
|
93
|
+
"ReceivedLink",
|
|
94
|
+
"ReceivedText",
|
|
95
|
+
"ServerError",
|
|
96
|
+
"SiteConfig",
|
|
97
|
+
"SourceChanged",
|
|
98
|
+
"TextClip",
|
|
99
|
+
"Timeout",
|
|
100
|
+
"TooLarge",
|
|
101
|
+
"Unauthorized",
|
|
102
|
+
"UnexpectedResponse",
|
|
103
|
+
"Unsupported",
|
|
104
|
+
"UploadIncomplete",
|
|
105
|
+
"UploadSessionExpired",
|
|
106
|
+
"UploadedClip",
|
|
107
|
+
"__version__",
|
|
108
|
+
"configure",
|
|
109
|
+
"info",
|
|
110
|
+
"read",
|
|
111
|
+
"receive",
|
|
112
|
+
"save",
|
|
113
|
+
# sync helpers
|
|
114
|
+
"send_file",
|
|
115
|
+
"send_text",
|
|
116
|
+
"shared",
|
|
117
|
+
"shutdown",
|
|
118
|
+
"stream",
|
|
119
|
+
]
|