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.
- {simple_rule34-1.0.0.0/src/simple_rule34.egg-info → simple_rule34-1.0.0.1}/PKG-INFO +1 -1
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/pyproject.toml +1 -1
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/SimpleRule34/types.py +10 -2
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1/src/simple_rule34.egg-info}/PKG-INFO +1 -1
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/tests/test.py +1 -4
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/LICENSE +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/README.md +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/setup.cfg +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/SimpleRule34/__init__.py +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/SimpleRule34/exceptions.py +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/SimpleRule34/main.py +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/SimpleRule34/utils.py +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/__init__.py +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/simple_rule34.egg-info/SOURCES.txt +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/simple_rule34.egg-info/dependency_links.txt +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/simple_rule34.egg-info/requires.txt +0 -0
- {simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/simple_rule34.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simple_rule34
|
|
3
|
-
Version: 1.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
|
|
@@ -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
|
-
|
|
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.
|
|
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
|
|
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
|
{simple_rule34-1.0.0.0 → simple_rule34-1.0.0.1}/src/simple_rule34.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|