simple-rule34 1.0.0.0__tar.gz → 1.0.0.1__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
1
  Metadata-Version: 2.4
2
2
  Name: simple_rule34
3
- Version: 1.0.0.0
3
+ Version: 1.0.0.1
4
4
  Summary: Simple api wrapper of rule34.xxx for python with asynchronous support
5
5
  Author-email: StarMan12 <author@example.com>
6
6
  Project-URL: Homepage, https://github.com/SyperAlexKomp/simple-rule34-api
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "simple_rule34"
7
- version = "1.0.0.0"
7
+ version = "1.0.0.1"
8
8
  authors = [
9
9
  { name="StarMan12", email="author@example.com" },
10
10
  ]
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import typing
3
3
  import re
4
+ import warnings
4
5
 
5
6
  from enum import Enum
6
7
  from pathlib import Path
@@ -23,9 +24,12 @@ class File(BaseModel):
23
24
 
24
25
  self.type = get_file_type(str(self.url))
25
26
 
26
- async def download(self, path: Path | str = "./rule34_downloads") -> Path:
27
+ async def download(self, path: Path | str = "./rule34_downloads", file_name: Path | str = None) -> Path:
27
28
  if isinstance(path, str):
28
29
  path = Path(path)
30
+ if isinstance(file_name, str):
31
+ file_name = Path(file_name)
32
+
29
33
  # Create storage path
30
34
  path.mkdir(parents=True, exist_ok=True)
31
35
 
@@ -35,7 +39,11 @@ class File(BaseModel):
35
39
  raise ApiException(f"Api returned status code {response.status} with message"
36
40
  f" {await response.text()}")
37
41
 
38
- file_name = os.path.basename(str(self.url))
42
+ original_file_name = Path(os.path.basename(str(self.url)))
43
+ file_name = original_file_name if file_name is None else file_name
44
+ if file_name.suffix != original_file_name.suffix:
45
+ warnings.warn("Provided file name suffix does not match original file name suffix. File can be corrupted.")
46
+
39
47
  save_path = path / file_name
40
48
 
41
49
  async with aiofiles.open(save_path, 'wb') as file:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simple_rule34
3
- Version: 1.0.0.0
3
+ Version: 1.0.0.1
4
4
  Summary: Simple api wrapper of rule34.xxx for python with asynchronous support
5
5
  Author-email: StarMan12 <author@example.com>
6
6
  Project-URL: Homepage, https://github.com/SyperAlexKomp/simple-rule34-api
@@ -9,10 +9,7 @@ async def foo(_id):
9
9
  return p[-1].id
10
10
 
11
11
  async def main():
12
- while True:
13
- i = input("Enter tag: ")
14
- for x in await api.autocomplete.search(text=i):
15
- print(x)
12
+ posts = await api.
16
13
 
17
14
 
18
15
 
File without changes