quickspirit 1.0.5__py3-none-any.whl → 2.0.2__py3-none-any.whl

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,8 +1,10 @@
1
+ from .http_async_downloader import HttpAsyncDownloader
1
2
  from .http_errors import RequestError
2
3
  from .http_async_client import HttpAsyncClient
3
4
  from .models import Result
4
5
 
5
6
  __all__ = [
7
+ "HttpAsyncDownloader",
6
8
  "RequestError",
7
9
  "HttpAsyncClient",
8
10
  "Result",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: quickspirit
3
- Version: 1.0.5
3
+ Version: 2.0.2
4
4
  Summary: Fast, Async Network & File Downloader Client In Python
5
5
  Home-page: https://github.com/DroidZed/QuickSpirit-Async
6
6
  License: GPL-3.0-or-later
@@ -19,14 +19,12 @@ Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
21
  Classifier: Programming Language :: Python :: 3.13
22
- Provides-Extra: downloader
23
22
  Requires-Dist: aiofiles (>=24.1.0)
24
- Requires-Dist: aiofiles ; extra == "downloader"
25
23
  Requires-Dist: httpx (>=0.27.0)
26
24
  Project-URL: Repository, https://github.com/DroidZed/QuickSpirit-Async
27
25
  Description-Content-Type: text/markdown
28
26
 
29
- # Quick Spirit
27
+ # Quick Spirit 🐬
30
28
 
31
29
  An easy to use HTTP client with a fast downloader.
32
30
 
@@ -52,6 +50,37 @@ poetry add quickspirit
52
50
  uv add quickspirit
53
51
  ```
54
52
 
53
+ ## Usage:
54
+
55
+ The library's internal mechanism returns a bytes data repersenting the bytes coming in from the network. Since we don't know the shape of the data, I delegated the responsibility to you to figure out how to parse it to your liking.
56
+
57
+ A sample code would look like this:
58
+
59
+ ```py
60
+ from quickspirit import HttpAsyncClient
61
+ from asyncio import run
62
+ from json import joads
63
+ from typing import Any
64
+
65
+ async def main():
66
+ result = await HttpAsyncClient().get("https://some distant url returning json hopefully")
67
+
68
+ if result.Error:
69
+ raise result.Error
70
+
71
+
72
+ data: dict[str, Any] = loads(result.Data)
73
+
74
+ # do whatever you need now that you have the data...
75
+
76
+
77
+ if __name__ == "__main__":
78
+ run(main())
79
+
80
+ ```
81
+
82
+ A complete example can be found in the [`example`](https://github.com/DroidZed/QuickSpirit-Async/tree/main/example) directory.
83
+
55
84
  ## Testing:
56
85
 
57
86
  Clone with git:
@@ -60,13 +89,17 @@ Clone with git:
60
89
  git clone https://github.com/DroidZed/QuickSpirit-Async && cd QuickSpirit-Async
61
90
  ```
62
91
 
63
- Create a virtual env:
92
+ Create a virtual env and install the dependencies in it:
64
93
 
65
94
  ```sh
66
95
  python3 -m venv .venv && .venv/Scripts/activate
96
+
97
+ # I built the project using poetry, so you may want to have that inside of your venv ! No need to install it in your global python install.
98
+ poetry install --no-root
99
+
67
100
  ```
68
101
 
69
- Run the tests with pytest (install it first using your package manager of choice):
102
+ Run the tests with pytest:
70
103
 
71
104
  ```sh
72
105
  # Here I'm using uv to run the tests, but the command should be the same for other package manager:
@@ -74,4 +107,7 @@ Run the tests with pytest (install it first using your package manager of choice
74
107
  pytest -vs .
75
108
  ```
76
109
 
110
+ ## Licensing
111
+
112
+ The project is under the GPT-3.0 License, see the [`License`](https://github.com/DroidZed/QuickSpirit-Async/blob/main/LICENSE) file for details.
77
113
 
@@ -0,0 +1,9 @@
1
+ quickspirit/__init__.py,sha256=JYvqruAR5WC_fAEPSLwJZbFcyg8VbTP9HpwPwhqBcsM,301
2
+ quickspirit/http_async_client.py,sha256=KFllZ4eYUgw9R_V9qajzHmwcCkui1BJEbix33fFH97w,6487
3
+ quickspirit/http_async_downloader.py,sha256=poOvyS8YjMo_E17LiI-klYStrLgRezSq7P0Y5MoQ7Tg,1073
4
+ quickspirit/http_errors.py,sha256=_Hsj_OAfllFjZkW5NjN9c4Qw8zsSg5M4eOnNyepOKCU,272
5
+ quickspirit/models.py,sha256=nQGsnaerR1DIUoIdjNFSoLQUc16QMJVXnBa9qTDEKIo,188
6
+ quickspirit-2.0.2.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
7
+ quickspirit-2.0.2.dist-info/METADATA,sha256=gFb1h4qHcM7U7UycWDih7HWfmsIGHT3Y0JgUYcwc8Lg,3106
8
+ quickspirit-2.0.2.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
9
+ quickspirit-2.0.2.dist-info/RECORD,,
File without changes
@@ -1,5 +0,0 @@
1
- from .http_async_downloader import HttpAsyncDownloader
2
-
3
- __all__ = [
4
- "HttpAsyncDownloader",
5
- ]
File without changes
@@ -1,16 +0,0 @@
1
- import pytest
2
-
3
- from ..downloader import HttpAsyncDownloader
4
-
5
-
6
- class TestHttpDownloader:
7
- @pytest.mark.asyncio
8
- async def test_should_download_file(self):
9
- client = HttpAsyncDownloader()
10
- await client.get_file_from_url(
11
- "https://api.coinpaprika.com/v1/coins",
12
- "./db.json",
13
- )
14
-
15
- with open("./db.json", "r") as f:
16
- assert f is not None
File without changes
File without changes
@@ -1,65 +0,0 @@
1
- import pytest
2
- from typing import Any
3
- from dataclasses import dataclass
4
- from json import loads
5
-
6
- from ..http import HttpAsyncClient
7
-
8
-
9
- @dataclass
10
- class CharacterData:
11
- id: int
12
- name: str
13
-
14
- def __init__(self, json: dict[str, Any]):
15
- self.id = json["id"]
16
- self.name = json["name"]
17
-
18
-
19
- @dataclass
20
- class AnimeData:
21
- id: int
22
- name: str
23
- altName: str
24
-
25
- def __init__(self, json: dict[str, Any]):
26
- self.id = json["id"]
27
- self.name = json["name"]
28
- self.altName = json["altName"]
29
-
30
-
31
- @dataclass
32
- class QuoteData:
33
- content: str
34
- anime: AnimeData
35
- character: CharacterData
36
-
37
- def __init__(self, json: dict[str, Any]):
38
- self.content = json["content"]
39
- self.anime = AnimeData(json["anime"])
40
- self.character = CharacterData(json["character"])
41
-
42
-
43
- @dataclass
44
- class Quote:
45
- status: str
46
- data: QuoteData
47
-
48
- def __init__(self, json: dict[str, Any]):
49
- self.status = json["status"]
50
- self.data = QuoteData(json["data"])
51
-
52
-
53
- class TestNetworkClient:
54
- @pytest.mark.asyncio
55
- async def test_should_get_a_random_anime_quote(self):
56
- client = HttpAsyncClient()
57
- data = await client.get("https://animechan.io/api/v1/quotes/random")
58
-
59
- assert data.Error is None
60
-
61
- content: Quote = Quote(loads(data.Data))
62
-
63
- assert content.status == "success"
64
-
65
- print(content)
@@ -1,16 +0,0 @@
1
- quick_spirit_downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- quick_spirit_downloader/downloader/__init__.py,sha256=EXPvc7M9xYTjVWav3lDDqFlhcvTYjtAZtcsgTg1JQYk,102
3
- quick_spirit_downloader/downloader/http_async_downloader.py,sha256=poOvyS8YjMo_E17LiI-klYStrLgRezSq7P0Y5MoQ7Tg,1073
4
- quick_spirit_downloader/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- quick_spirit_downloader/tests/test_http_downloader.py,sha256=Ju5nC7Y76atf2WgUyN9FUQVRgFcj33jq9Cj0uu_Y8zI,418
6
- quick_spirit_http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- quick_spirit_http/http/__init__.py,sha256=LQJ2SJ1ghtldWSW6KyQW2vQkNZJu6DcqPhzbO15af4s,217
8
- quick_spirit_http/http/http_async_client.py,sha256=KFllZ4eYUgw9R_V9qajzHmwcCkui1BJEbix33fFH97w,6487
9
- quick_spirit_http/http/http_errors.py,sha256=_Hsj_OAfllFjZkW5NjN9c4Qw8zsSg5M4eOnNyepOKCU,272
10
- quick_spirit_http/http/models.py,sha256=nQGsnaerR1DIUoIdjNFSoLQUc16QMJVXnBa9qTDEKIo,188
11
- quick_spirit_http/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- quick_spirit_http/tests/test_network_client.py,sha256=od4i3PYwjCbrXbXrFy521MRnWqa_jcrzrJ_fomh4eYE,1437
13
- quickspirit-1.0.5.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
14
- quickspirit-1.0.5.dist-info/METADATA,sha256=7QUCn02mP760mfF-QLqnEhjNde2-62PyX2M2uKhKIMY,2026
15
- quickspirit-1.0.5.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
16
- quickspirit-1.0.5.dist-info/RECORD,,
File without changes
File without changes