apify 1.1.4b4__py3-none-any.whl → 1.1.5__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.

Potentially problematic release.


This version of apify might be problematic. Click here for more details.

apify/consts.py CHANGED
@@ -61,4 +61,5 @@ BASE64_REGEXP = '[-A-Za-z0-9+/]*={0,3}'
61
61
  ENCRYPTED_INPUT_VALUE_PREFIX = 'ENCRYPTED_VALUE'
62
62
  ENCRYPTED_INPUT_VALUE_REGEXP = re.compile(f'^{ENCRYPTED_INPUT_VALUE_PREFIX}:({BASE64_REGEXP}):({BASE64_REGEXP})$')
63
63
 
64
- MAX_PAYLOAD_SIZE_BYTES = 9437184 # 9MB
64
+ # 9MB
65
+ MAX_PAYLOAD_SIZE_BYTES = 9437184
apify/event_manager.py CHANGED
@@ -34,7 +34,7 @@ class EventManager:
34
34
  _connected_to_platform_websocket: Optional[asyncio.Future] = None
35
35
 
36
36
  def __init__(self, config: Configuration) -> None:
37
- """Crate an instance of EventManager.
37
+ """Create an instance of the EventManager.
38
38
 
39
39
  Args:
40
40
  config (Configuration): The actor configuration to be used in this event manager.
apify/log.py CHANGED
@@ -17,6 +17,7 @@ logger_name = __name__.split('.')[0]
17
17
  # Logger used throughout the library
18
18
  logger = logging.getLogger(logger_name)
19
19
 
20
+ _LOG_NAME_COLOR = Fore.LIGHTBLACK_EX
20
21
 
21
22
  _LOG_LEVEL_COLOR = {
22
23
  logging.DEBUG: Fore.BLUE,
@@ -54,6 +55,15 @@ class ActorLogFormatter(logging.Formatter):
54
55
  # and extract all the extra ones not present in the empty log record
55
56
  empty_record = logging.LogRecord('dummy', 0, 'dummy', 0, 'dummy', None, None)
56
57
 
58
+ def __init__(self, include_logger_name: bool = False, *args: tuple, **kwargs: dict) -> None:
59
+ """Create an instance of the ActorLogFormatter.
60
+
61
+ Args:
62
+ include_logger_name: Include logger name at the beginning of the log line. Defaults to False.
63
+ """
64
+ super().__init__(*args, **kwargs) # type: ignore
65
+ self.include_logger_name = include_logger_name
66
+
57
67
  def _get_extra_fields(self, record: logging.LogRecord) -> Dict[str, Any]:
58
68
  extra_fields: Dict[str, Any] = {}
59
69
  for key, value in record.__dict__.items():
@@ -72,6 +82,8 @@ class ActorLogFormatter(logging.Formatter):
72
82
  - then has the stringified extra log fields
73
83
  - then, if an exception is a part of the log record, prints the formatted exception.
74
84
  """
85
+ logger_name_string = f'{_LOG_NAME_COLOR}[{record.name}]{Style.RESET_ALL} '
86
+
75
87
  # Colorize the log level, and shorten it to 6 chars tops
76
88
  level_color_code = _LOG_LEVEL_COLOR.get(record.levelno, '')
77
89
  level_short_alias = _LOG_LEVEL_SHORT_ALIAS.get(record.levelno, record.levelname)
@@ -97,4 +109,8 @@ class ActorLogFormatter(logging.Formatter):
97
109
  log_string = super().format(record)
98
110
  log_string = textwrap.indent(log_string, _LOG_MESSAGE_INDENT).lstrip()
99
111
 
100
- return f'{level_string}{log_string}{extra_string}{exception_string}'
112
+ if self.include_logger_name:
113
+ # Include logger name at the beginning of the log line
114
+ return f'{logger_name_string}{level_string}{log_string}{extra_string}{exception_string}'
115
+ else:
116
+ return f'{level_string}{log_string}{extra_string}{exception_string}'
apify/storages/dataset.py CHANGED
@@ -17,7 +17,8 @@ from ..consts import MAX_PAYLOAD_SIZE_BYTES
17
17
  from .base_storage import BaseStorage
18
18
  from .key_value_store import KeyValueStore
19
19
 
20
- SAFETY_BUFFER_PERCENT = 0.01 / 100 # 0.01%
20
+ # 0.01%
21
+ SAFETY_BUFFER_PERCENT = 0.01 / 100
21
22
  EFFECTIVE_LIMIT_BYTES = MAX_PAYLOAD_SIZE_BYTES - math.ceil(MAX_PAYLOAD_SIZE_BYTES * SAFETY_BUFFER_PERCENT)
22
23
 
23
24
 
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2022 Apify Technologies s.r.o.
189
+ Copyright 2023 Apify Technologies s.r.o.
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apify
3
- Version: 1.1.4b4
3
+ Version: 1.1.5
4
4
  Summary: Apify SDK for Python
5
5
  Author-email: "Apify Technologies s.r.o." <support@apify.com>
6
6
  License: Apache Software License
@@ -56,15 +56,13 @@ Requires-Dist: isort ~=5.12.0 ; extra == 'dev'
56
56
  Requires-Dist: mypy ~=1.3.0 ; extra == 'dev'
57
57
  Requires-Dist: pep8-naming ~=0.13.3 ; extra == 'dev'
58
58
  Requires-Dist: pre-commit ~=3.3.2 ; extra == 'dev'
59
+ Requires-Dist: pydoc-markdown ~=4.8.2 ; extra == 'dev'
59
60
  Requires-Dist: pytest ~=7.3.1 ; extra == 'dev'
60
61
  Requires-Dist: pytest-asyncio ~=0.21.0 ; extra == 'dev'
61
62
  Requires-Dist: pytest-only ~=2.0.0 ; extra == 'dev'
62
63
  Requires-Dist: pytest-timeout ~=2.1.0 ; extra == 'dev'
63
64
  Requires-Dist: pytest-xdist ~=3.3.1 ; extra == 'dev'
64
65
  Requires-Dist: respx ~=0.20.1 ; extra == 'dev'
65
- Requires-Dist: sphinx ~=6.1.3 ; extra == 'dev'
66
- Requires-Dist: sphinx-autodoc-typehints ~=1.22 ; extra == 'dev'
67
- Requires-Dist: sphinx-markdown-builder ==0.5.4 ; extra == 'dev'
68
66
  Requires-Dist: twine ~=4.0.2 ; extra == 'dev'
69
67
  Requires-Dist: types-aiofiles ~=23.1.0.3 ; extra == 'dev'
70
68
  Requires-Dist: types-colorama ~=0.4.15.11 ; extra == 'dev'
@@ -91,9 +89,10 @@ import requests
91
89
 
92
90
  async def main():
93
91
  async with Actor:
94
- response = requests.get('https://apify.com')
92
+ input = await Actor.get_input()
93
+ response = requests.get(input['url'])
95
94
  soup = BeautifulSoup(response.content, 'html.parser')
96
- await Actor.push_data({ 'url': url, 'title': soup.title.string })
95
+ await Actor.push_data({ 'url': input['url'], 'title': soup.title.string })
97
96
  ```
98
97
 
99
98
  ## What are Actors?
@@ -3,9 +3,9 @@ apify/_crypto.py,sha256=aFgJ6LZM_ZM_Hb3FCHVGt2DEjWJxOXWzOdCKdkBHoSA,5753
3
3
  apify/_utils.py,sha256=uYX3ro6yM5Ppuz4vEGz-xiChGEJaaIl3U2w4AVk2q3k,12602
4
4
  apify/actor.py,sha256=gom2J--Ypgw9UZCgZwKw6EFwlj55CWycbyNJBl5T9VI,59601
5
5
  apify/config.py,sha256=MCk-n03H62hrc15dHmhzGM5ivW9H-wqJNpzgLzkhO2I,8717
6
- apify/consts.py,sha256=SheHk312OQnlemvir5YkWkCTZDes8uCl3puVZeUuNv4,2229
7
- apify/event_manager.py,sha256=Z2QaZPa4hWVlPMptGm_ZSLd8xkm3T8Da_xNBn5hfM50,10431
8
- apify/log.py,sha256=G5Bk71lIXmSXCPNIfjE8cG-uLhPwUPV3JtqKzUu6oOA,4026
6
+ apify/consts.py,sha256=ElVGmjDAP6tPWqz-fR-r_1zuCX8AyAA1llgYjPS6SQU,2228
7
+ apify/event_manager.py,sha256=2-QcQHGOSZd3mJN8_-MbGucXMPS3ZqMPJVzlnCrG9P8,10436
8
+ apify/log.py,sha256=kGsbTFbbezPEPwIk2wiopb-mI0k0hHqVFeCN6Xec17Y,4770
9
9
  apify/proxy_configuration.py,sha256=wE8FEtZXaE5mknhvUXYlNVo_xNI0l60gqgNNclVYKb4,15545
10
10
  apify/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  apify/_memory_storage/__init__.py,sha256=frNb9kh6bfKtZNEMe2PA_QlT6DTUbhffcNfWhELiZNQ,90
@@ -22,12 +22,12 @@ apify/_memory_storage/resource_clients/request_queue.py,sha256=Fp1EdBSHtFt9zQlbz
22
22
  apify/_memory_storage/resource_clients/request_queue_collection.py,sha256=_diuJAIoMKJrUTcY2U8IwHOcI21i-znS004YKcTmmLo,1480
23
23
  apify/storages/__init__.py,sha256=oYUCrNcECYMXX0wtHbaYhD2hWH3drau8OyXVdtNOk80,249
24
24
  apify/storages/base_storage.py,sha256=l0OB1w23rwDK_cnvp33W725T4aHUXexlOHRUCNCs4RU,7089
25
- apify/storages/dataset.py,sha256=kyhlddpE_a3QetoT-LgY1Q2F_YWHE2ZSP1HXjP68QC0,23436
25
+ apify/storages/dataset.py,sha256=1F4GIx44S1rgYxlyuCeiWwcXhki5voJJkw9xR-ZtUGU,23435
26
26
  apify/storages/key_value_store.py,sha256=3lF3dNb3uvWKSmza5Qb9-Dna4czCOcPOImzwDVzgdjc,10132
27
27
  apify/storages/request_queue.py,sha256=KCvSYzJ-9pgGvfTnX-K05Mdb3wq7UROtxW8zczrE6ZI,25891
28
28
  apify/storages/storage_client_manager.py,sha256=zqrjVpSE4eM6BM3Z87yLmNxMsiZep8bf0aSaX8125PE,2224
29
- apify-1.1.4b4.dist-info/LICENSE,sha256=_yIHo4TZezG4fMaWG1Er6OH7DW7MiZI-KO4dnONASZI,11355
30
- apify-1.1.4b4.dist-info/METADATA,sha256=fWWceWGmdV4CPz4xGENhFpRDfkl-2TEEvBC4tfmjHsc,6285
31
- apify-1.1.4b4.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
32
- apify-1.1.4b4.dist-info/top_level.txt,sha256=2oFNsHggn5m_rCaaP7xijQg_-Va2ByOSYuvKgACsS5w,6
33
- apify-1.1.4b4.dist-info/RECORD,,
29
+ apify-1.1.5.dist-info/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
30
+ apify-1.1.5.dist-info/METADATA,sha256=dftrd3xJL0G7eqMHpiX1fV2D70fHJg_XcI0DIQ2A2K0,6205
31
+ apify-1.1.5.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
32
+ apify-1.1.5.dist-info/top_level.txt,sha256=2oFNsHggn5m_rCaaP7xijQg_-Va2ByOSYuvKgACsS5w,6
33
+ apify-1.1.5.dist-info/RECORD,,
File without changes