jerkup 2.0.0__tar.gz → 2.2.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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: jerkup
3
- Version: 2.0.0
3
+ Version: 2.2.0
4
4
  Summary: Hamster Uploader
5
5
  License: MIT
6
6
  Author: deadmaster
@@ -9,10 +9,11 @@ Requires-Python: >=3.13,<4.0
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Programming Language :: Python :: 3.14
12
13
  Classifier: Topic :: Internet :: WWW/HTTP
13
- Requires-Dist: msgspec (>=0.19.0,<0.20.0)
14
- Requires-Dist: platformdirs (>=4.3.7,<5.0.0)
15
- Requires-Dist: requests (>=2.32.3,<3.0.0)
14
+ Requires-Dist: msgspec (>=0.20.0,<0.21.0)
15
+ Requires-Dist: platformdirs (>=4.5.1,<5.0.0)
16
+ Requires-Dist: requests (>=2.32.5,<3.0.0)
16
17
  Requires-Dist: requests-toolbelt (>=1.0.0,<2.0.0)
17
18
  Project-URL: Repository, https://codeberg.org/deadmaster/jerkup
18
19
  Description-Content-Type: text/markdown
@@ -35,10 +35,10 @@ FORMAT_MAP: dict[str, str] = {
35
35
  }
36
36
 
37
37
 
38
- def parse_tags(tags: str) -> list[str]:
38
+ def parse_tags(tags: str) -> tuple[str, ...]:
39
39
  if not tags:
40
- return []
41
- return list(map(str.strip, tags.split(',')))
40
+ return ()
41
+ return tuple(map(str.strip, tags.split(',')))
42
42
 
43
43
 
44
44
  def create_parser(require_api_key: bool) -> argparse.ArgumentParser:
@@ -183,7 +183,7 @@ def main() -> None:
183
183
  api_key: typing.Optional[str] = options.api_key
184
184
  title: typing.Optional[str] = options.title
185
185
  description: typing.Optional[str] = options.description
186
- tags: typing.Optional[list[str]] = options.tags
186
+ tags: typing.Optional[tuple[str, ...]] = options.tags
187
187
  album_id: typing.Optional[str] = options.album
188
188
  category_id: typing.Optional[int] = options.category
189
189
  width: typing.Optional[int] = options.width
@@ -10,16 +10,13 @@ import requests_toolbelt # type: ignore[import-untyped]
10
10
  from .iso8601 import format_duration
11
11
  from .messages import DECODER
12
12
 
13
- ENDPOINT = 'https://hamster.is/api/1/upload'
14
- TIMEOUT = (10.0, 30.0)
15
-
16
13
 
17
14
  # https://v4-docs.chevereto.com/developer/api/api-v1.html
18
15
  @dataclasses.dataclass(eq=False, frozen=True, kw_only=True)
19
16
  class Settings:
20
17
  title: typing.Optional[str] = None
21
18
  description: typing.Optional[str] = None
22
- tags: typing.Optional[list[str]] = None
19
+ tags: typing.Optional[tuple[str, ...]] = None
23
20
  album_id: typing.Optional[str] = None
24
21
  category_id: typing.Optional[int] = None
25
22
  width: typing.Optional[int] = None
@@ -29,6 +26,8 @@ class Settings:
29
26
 
30
27
 
31
28
  DEFAULT_SETTINGS = Settings()
29
+ DEFAULT_ENDPOINT = 'https://hamsterimg.net/api/1/upload'
30
+ DEFAULT_TIMEOUT = (10.0, 30.0)
32
31
 
33
32
 
34
33
  @dataclasses.dataclass(eq=False, frozen=True, kw_only=True)
@@ -44,6 +43,8 @@ def upload(
44
43
  path: typing.Union[str, os.PathLike[str]],
45
44
  api_key: str,
46
45
  settings: Settings = DEFAULT_SETTINGS,
46
+ endpoint: str = DEFAULT_ENDPOINT,
47
+ timeout: typing.Union[float, tuple[float, float], tuple[float, None], None] = DEFAULT_TIMEOUT,
47
48
  ) -> Result:
48
49
  mimetypes.init()
49
50
  mime_type, _ = mimetypes.guess_type(path)
@@ -77,7 +78,7 @@ def upload(
77
78
  headers = {'X-API-Key': api_key, 'Content-Type': encoder.content_type}
78
79
 
79
80
  with session.post(
80
- ENDPOINT, data=encoder, headers=headers, timeout=TIMEOUT, allow_redirects=False
81
+ endpoint, data=encoder, headers=headers, timeout=timeout, allow_redirects=False
81
82
  ) as response:
82
83
  response.raise_for_status()
83
84
  data = DECODER.decode(response.content)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "jerkup"
3
- version = "2.0.0"
3
+ version = "2.2.0"
4
4
  description = "Hamster Uploader"
5
5
  license = "MIT"
6
6
  authors = ["deadmaster <deadmaster@noreply.codeberg.org>"]
@@ -10,15 +10,15 @@ classifiers = ["Topic :: Internet :: WWW/HTTP"]
10
10
 
11
11
  [tool.poetry.dependencies]
12
12
  python = "^3.13"
13
- requests = "^2.32.3"
13
+ requests = "^2.32.5"
14
14
  requests-toolbelt = "^1.0.0"
15
- msgspec = "^0.19.0"
16
- platformdirs = "^4.3.7"
15
+ msgspec = "^0.20.0"
16
+ platformdirs = "^4.5.1"
17
17
 
18
18
  [tool.poetry.group.dev.dependencies]
19
- mypy = "^1.15.0"
20
- ruff = "^0.11.8"
21
- types-requests = "^2.32.0"
19
+ mypy = "^1.19.1"
20
+ ruff = "^0.14.10"
21
+ types-requests = "^2.32.4"
22
22
 
23
23
  [tool.poetry.scripts]
24
24
  jerkup = "jerkup.__main__:main"
@@ -31,7 +31,7 @@ indent-width = 4
31
31
 
32
32
  [tool.ruff.lint]
33
33
  select = ["F", "I", "UP", "G"]
34
- ignore = ["UP007", "UP015", "UP032", "UP038"]
34
+ ignore = ["UP007", "UP015", "UP032", "UP045", "UP046"]
35
35
 
36
36
  [tool.ruff.lint.isort]
37
37
  split-on-trailing-comma = false
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes