esuls 0.1.7__tar.gz → 0.1.9__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: esuls
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Utility library for async database operations, HTTP requests, and parallel execution
5
5
  Author-email: IperGiove <ipergiove@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "esuls"
7
- version = "0.1.7"
7
+ version = "0.1.9"
8
8
  description = "Utility library for async database operations, HTTP requests, and parallel execution"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.14"
@@ -249,6 +249,7 @@ async def make_request(
249
249
  params: Optional[Dict[str, Any]] = None,
250
250
  json_data: Optional[JsonType] = None,
251
251
  files: Optional[Dict[str, FileData]] = None,
252
+ data: Optional[Union[str, bytes]] = None,
252
253
  proxy: Optional[str] = None,
253
254
  timeout_request: int = 60,
254
255
  max_attempt: int = 10,
@@ -289,6 +290,7 @@ async def make_request(
289
290
  files=files_dict,
290
291
  headers=request_headers,
291
292
  timeout=timeout_request,
293
+ data=data,
292
294
  )
293
295
 
294
296
  # Create custom Response object
@@ -330,8 +332,8 @@ async def make_request(
330
332
  # Validate JSON response
331
333
  if json_response:
332
334
  try:
333
- data = response.json()
334
- if json_response_check and json_response_check not in data:
335
+ response_data = response.json()
336
+ if json_response_check and json_response_check not in response_data:
335
337
  if attempt + 1 == max_attempt:
336
338
  return None
337
339
  await asyncio.sleep(exception_sleep)
@@ -8,22 +8,21 @@ T = TypeVar("T")
8
8
 
9
9
 
10
10
  async def run_parallel(
11
- *functions: Callable[[], Awaitable[T]],
11
+ *coroutines: Awaitable[T],
12
12
  limit: int = 20
13
13
  ) -> List[T]:
14
- """
15
- run parallel multiple functions
16
- """
14
+ """Run parallel coroutines with semaphore limit"""
15
+
17
16
  semaphore = asyncio.Semaphore(limit)
18
-
19
- async def limited_function(func: Callable[[], Awaitable[T]]) -> T:
17
+
18
+ async def limited_coroutine(coro: Awaitable[T]) -> T:
20
19
  async with semaphore:
21
- return await func()
22
-
23
- tasks = [asyncio.create_task(limited_function(func)) for func in functions]
24
-
20
+ return await coro
21
+
22
+ tasks = [asyncio.create_task(limited_coroutine(coro)) for coro in coroutines]
23
+
25
24
  results = []
26
25
  for fut in asyncio.as_completed(tasks):
27
26
  results.append(await fut)
28
-
27
+
29
28
  return results
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esuls
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Utility library for async database operations, HTTP requests, and parallel execution
5
5
  Author-email: IperGiove <ipergiove@gmail.com>
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes