apify 2.5.1b7__py3-none-any.whl → 2.5.1b8__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.

@@ -178,7 +178,9 @@ class ProxyConfiguration(CrawleeProxyConfiguration):
178
178
  self._country_code = country_code
179
179
 
180
180
  async def initialize(self) -> None:
181
- """Load the Apify Proxy password if the API token is provided and check access to Apify Proxy and proxy groups.
181
+ """Check if using proxy, if so, check the access.
182
+
183
+ Load the Apify Proxy password from API (only if not passed to constructor or through env var).
182
184
 
183
185
  Only called if Apify Proxy configuration is used. Also checks if country has access to Apify Proxy groups
184
186
  if the country code is provided.
@@ -187,7 +189,17 @@ class ProxyConfiguration(CrawleeProxyConfiguration):
187
189
  `ProxyConfiguration` instance instead of calling this manually.
188
190
  """
189
191
  if self._uses_apify_proxy:
190
- await self._maybe_fetch_password()
192
+ if not self._password:
193
+ await self._maybe_fetch_password()
194
+ if not self._password:
195
+ raise ValueError(
196
+ 'Apify Proxy password must be provided using the "password" constructor argument '
197
+ f'or the "{ApifyEnvVars.PROXY_PASSWORD}" environment variable. '
198
+ f'You can also provide your Apify token via the "${ApifyEnvVars.TOKEN}" environment variable, '
199
+ f'so that the SDK can fetch the proxy password from Apify API, '
200
+ f'when not provided through constructor or ${ApifyEnvVars.PROXY_PASSWORD}.'
201
+ )
202
+
191
203
  await self._check_access()
192
204
 
193
205
  async def new_proxy_info(
@@ -255,22 +267,7 @@ class ProxyConfiguration(CrawleeProxyConfiguration):
255
267
  user_info = await self._apify_client.user().get()
256
268
  if user_info:
257
269
  password = user_info['proxy']['password']
258
-
259
- if self._password:
260
- if self._password != password:
261
- logger.warning(
262
- 'The Apify Proxy password you provided belongs to a different user than the Apify '
263
- 'token you are using. Are you sure this is correct?'
264
- )
265
- else:
266
- self._password = password
267
-
268
- if not self._password:
269
- raise ValueError(
270
- 'Apify Proxy password must be provided using the "password" constructor argument '
271
- f'or the "{ApifyEnvVars.PROXY_PASSWORD}" environment variable. If you add '
272
- f'the "{ApifyEnvVars.TOKEN}" environment variable, the password will be automatically inferred.'
273
- )
270
+ self._password = password
274
271
 
275
272
  async def _check_access(self) -> None:
276
273
  proxy_status_url = f'{self._configuration.proxy_status_url}/?format=json'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apify
3
- Version: 2.5.1b7
3
+ Version: 2.5.1b8
4
4
  Summary: Apify SDK for Python
5
5
  Project-URL: Homepage, https://docs.apify.com/sdk/python/
6
6
  Project-URL: Apify homepage, https://apify.com
@@ -6,7 +6,7 @@ apify/_consts.py,sha256=_Xq4hOfOA1iZ3n1P967YWdyncKivpbX6RTlp_qanUoE,330
6
6
  apify/_crypto.py,sha256=8BgeQC0ZhYP5KdmLxxLQAW87Gq-Z4HlREbYGXr46w0U,6607
7
7
  apify/_models.py,sha256=-Y0rljBJWxMMCp8iDCTG4UV3bEvNZzp-kx2SYbPfeIY,7919
8
8
  apify/_platform_event_manager.py,sha256=igi9dRTfB7t0mRBM1bCfzMh7RBbr5adrJ0iRymUQ8S8,7990
9
- apify/_proxy_configuration.py,sha256=c-O6_PZ9pUD-i4J0RFEKTtfyJPP2rTRJJA1TH8NVsV8,13189
9
+ apify/_proxy_configuration.py,sha256=eMeYr9mr2ITURBmgZw4Cel9kfkiLhdaxE47EDh-3okM,13091
10
10
  apify/_utils.py,sha256=7YL7VhmNND0XARsXtPQWWQCyK4825n-ZVB8n9cgWm0A,1838
11
11
  apify/log.py,sha256=j-E4t-WeA93bc1NCQRG8sTntehQCiiN8ia-MdQe3_Ts,1291
12
12
  apify/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -38,7 +38,7 @@ apify/scrapy/pipelines/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
38
38
  apify/storages/__init__.py,sha256=FW-z6ubuPnHGM-Wp15T8mR5q6lnpDGrCW-IkgZd5L30,177
39
39
  apify/storages/_request_list.py,sha256=FCC4X2MX2V8vLZBCUi5Q1qg9w62y9UkF4ptOqyPVhG8,6052
40
40
  apify/storages/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- apify-2.5.1b7.dist-info/METADATA,sha256=jCUxU2xFM8QmelPP_iv7AJblWJY4fOShi-YNogRlvkg,21557
42
- apify-2.5.1b7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
- apify-2.5.1b7.dist-info/licenses/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
44
- apify-2.5.1b7.dist-info/RECORD,,
41
+ apify-2.5.1b8.dist-info/METADATA,sha256=wCgLs9T_CIyul7M251sjURButHky0_k9D4iedFOd5lI,21557
42
+ apify-2.5.1b8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
+ apify-2.5.1b8.dist-info/licenses/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
44
+ apify-2.5.1b8.dist-info/RECORD,,