locust 2.29.1.dev31__py3-none-any.whl → 2.29.1.dev34__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.
locust/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '2.29.1.dev31'
16
- __version_tuple__ = version_tuple = (2, 29, 1, 'dev31')
15
+ __version__ = version = '2.29.1.dev34'
16
+ __version_tuple__ = version_tuple = (2, 29, 1, 'dev34')
locust/clients.py CHANGED
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING
7
7
  from urllib.parse import urlparse, urlunparse
8
8
 
9
9
  import requests
10
- from requests import Request, Response
10
+ from requests import Response
11
11
  from requests.adapters import HTTPAdapter
12
12
  from requests.auth import HTTPBasicAuth
13
13
  from requests.exceptions import InvalidSchema, InvalidURL, MissingSchema, RequestException
@@ -54,8 +54,10 @@ absolute_http_url_regexp = re.compile(r"^https?://", re.I)
54
54
 
55
55
 
56
56
  class LocustResponse(Response):
57
- def raise_for_status(self):
58
- if hasattr(self, "error") and self.error:
57
+ error: Exception | None = None
58
+
59
+ def raise_for_status(self) -> None:
60
+ if self.error:
59
61
  raise self.error
60
62
  Response.raise_for_status(self)
61
63
 
@@ -112,7 +114,7 @@ class HttpSession(requests.Session):
112
114
  self.mount("https://", LocustHttpAdapter(pool_manager=pool_manager))
113
115
  self.mount("http://", LocustHttpAdapter(pool_manager=pool_manager))
114
116
 
115
- def _build_url(self, path):
117
+ def _build_url(self, path) -> str:
116
118
  """prepend url with hostname unless it's already an absolute URL"""
117
119
  if absolute_http_url_regexp.match(path):
118
120
  return path
@@ -191,7 +193,7 @@ class HttpSession(requests.Session):
191
193
  response_time = (time.perf_counter() - start_perf_counter) * 1000
192
194
 
193
195
  request_before_redirect = (response.history and response.history[0] or response).request
194
- url = request_before_redirect.url
196
+ url = request_before_redirect.url # type: ignore
195
197
 
196
198
  if not name:
197
199
  name = request_before_redirect.path_url
@@ -225,7 +227,7 @@ class HttpSession(requests.Session):
225
227
  pass
226
228
  return response
227
229
 
228
- def _send_request_safe_mode(self, method, url, **kwargs):
230
+ def _send_request_safe_mode(self, method, url, **kwargs) -> Response | LocustResponse:
229
231
  """
230
232
  Send an HTTP request, and catch any exception that might occur due to connection problems.
231
233
 
@@ -238,8 +240,8 @@ class HttpSession(requests.Session):
238
240
  except RequestException as e:
239
241
  r = LocustResponse()
240
242
  r.error = e
241
- r.status_code = 0 # with this status_code, content returns None
242
- r.request = Request(method, url).prepare()
243
+ r.status_code = 0
244
+ r.request = e.request # type: ignore
243
245
  return r
244
246
 
245
247
  def get(
@@ -440,17 +442,11 @@ class LocustHttpAdapter(HTTPAdapter):
440
442
 
441
443
 
442
444
  # Monkey patch Response class to give some guidance
443
- def _success(self):
444
- raise LocustError(
445
- "If you want to change the state of the request, you must pass catch_response=True. See http://docs.locust.io/en/stable/writing-a-locustfile.html#validating-responses"
446
- )
447
-
448
-
449
- def _failure(self):
445
+ def _missing_catch_response_True(self, *_args, **_kwargs):
450
446
  raise LocustError(
451
- "If you want to change the state of the request, you must pass catch_response=True. See http://docs.locust.io/en/stable/writing-a-locustfile.html#validating-responses"
447
+ "If you want to change the state of the request using .success() or .failure(), you must pass catch_response=True. See http://docs.locust.io/en/stable/writing-a-locustfile.html#validating-responses"
452
448
  )
453
449
 
454
450
 
455
- Response.success = _success # type: ignore[attr-defined]
456
- Response.failure = _failure # type: ignore[attr-defined]
451
+ Response.success = _missing_catch_response_True # type: ignore[attr-defined]
452
+ Response.failure = _missing_catch_response_True # type: ignore[attr-defined]
@@ -324,6 +324,12 @@ class FastHttpUser(User):
324
324
  Note that setting this value has no effect when custom client_pool was given, and you need to spawn a your own gevent pool
325
325
  to use it (as Users only have one greenlet). See test_fasthttp.py / test_client_pool_concurrency for an example."""
326
326
 
327
+ proxy_host: str | None = None
328
+ """Parameter passed to FastHttpSession"""
329
+
330
+ proxy_port: int | None = None
331
+ """Parameter passed to FastHttpSession"""
332
+
327
333
  client_pool: HTTPClientPool | None = None
328
334
  """HTTP client pool to use. If not given, a new pool is created per single user."""
329
335
 
@@ -355,6 +361,8 @@ class FastHttpUser(User):
355
361
  client_pool=self.client_pool,
356
362
  ssl_context_factory=self.ssl_context_factory,
357
363
  headers=self.default_headers,
364
+ proxy_host=self.proxy_host,
365
+ proxy_port=self.proxy_port,
358
366
  )
359
367
  """
360
368
  Instance of HttpSession that is created upon instantiation of User.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: locust
3
- Version: 2.29.1.dev31
3
+ Version: 2.29.1.dev34
4
4
  Summary: Developer-friendly load testing framework
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/locustio/locust
@@ -1,8 +1,8 @@
1
1
  locust/__init__.py,sha256=Hmw2vNf75eLQ1mQIPXAwlQrJ_XFY65MOb92fGsNCukQ,1458
2
2
  locust/__main__.py,sha256=vBQ82334kX06ImDbFlPFgiBRiLIinwNk3z8Khs6hd74,31
3
- locust/_version.py,sha256=4_aPghH9jy3XETUhOBI9pUPtDewJ26sTX2m1Doiuzys,428
3
+ locust/_version.py,sha256=2F1cntyJqemK99KHeQVA-RUjqJ8W7rT7FyU0O5becYk,428
4
4
  locust/argument_parser.py,sha256=sjQoJ1NTac9LdNYT7zn8RajlWqBQs8YFNv6uRExb2gg,28941
5
- locust/clients.py,sha256=M9hOrS1ORRGAV1_419_bvD_bRZxA5A1SJkI-ouSmAkQ,19600
5
+ locust/clients.py,sha256=OHPv6hBAt4gt3HI67yqyT1qrSsF8uMdCwIRu0kIsRWI,19491
6
6
  locust/debug.py,sha256=We6Z9W0btkKSc7PxWmrZx-xMynvOOsKhG6jmDgQin0g,5134
7
7
  locust/dispatch.py,sha256=vYh0QEDFgJ3hY0HgSk-EiNO7IP9ffzXF_Et8wB9JvsI,16995
8
8
  locust/env.py,sha256=sP-fCnZs0e2xodRemLHgTgyyUt5eezwtdA9WsCoqJkQ,12767
@@ -18,7 +18,7 @@ locust/shape.py,sha256=t-lwBS8LOjWcKXNL7j2U3zroIXJ1b0fazUwpRYQOKXw,1973
18
18
  locust/stats.py,sha256=5jx9aD9Sky-kCZ3E-MjRT3xbwvxo9xyDtfcfP56zclo,45875
19
19
  locust/web.py,sha256=rN1NVeZ9LKSEeDwvpRbOJ0bcy8U1U4VjP-7vK7ejlwM,27367
20
20
  locust/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- locust/contrib/fasthttp.py,sha256=vByPepw35DF84qZ2xK89yHgjOA_8btV0wig_rSR6p4g,26757
21
+ locust/contrib/fasthttp.py,sha256=n6arQP1IH3CVP8PUaIhD-X5xWMAOj9F0JEJXPklun0Y,26999
22
22
  locust/rpc/__init__.py,sha256=nVGoHWFQxZjnhCDWjbgXIbmFbN9sizAjkhvSs9_642c,58
23
23
  locust/rpc/protocol.py,sha256=n-rb3GZQcAlldYDj4E4GuFGylYj_26GSS5U29meft5Y,1282
24
24
  locust/rpc/zmqrpc.py,sha256=AAY6w7wSFHsW34qqN28666boHFf6dTSAXPQJnAO6iUI,2707
@@ -71,9 +71,9 @@ locust/webui/dist/report.html,sha256=sOdZZVgZbqgu86BBCSQf3uQUYXgmgSnXF32JpnyAII8
71
71
  locust/webui/dist/assets/favicon.ico,sha256=IUl-rYqfpHdV38e-s0bkmFIeLS-n3Ug0DQxk-h202hI,8348
72
72
  locust/webui/dist/assets/index-84c63e70.js,sha256=cwyH4ju0OCRvFhg3O-0SYVBTFlN_XQeQ6YkymAO4Hco,1647185
73
73
  locust/webui/dist/assets/logo.png,sha256=EIVPqr6wE_yqguHaqFHIsH0ZACLSrvNWyYO7PbyIj4w,19299
74
- locust-2.29.1.dev31.dist-info/LICENSE,sha256=78XGpIn3fHVBfaxlPNUfjVufSN7QsdhpJMRJHv2AFpo,1095
75
- locust-2.29.1.dev31.dist-info/METADATA,sha256=U5UCAUiJPE_mT_7Bh65rXvHeOQhkaIGtHm2sIG2AFcY,7390
76
- locust-2.29.1.dev31.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
77
- locust-2.29.1.dev31.dist-info/entry_points.txt,sha256=RAdt8Ku-56m7bFjmdj-MBhbF6h4NX7tVODR9QNnOg0E,44
78
- locust-2.29.1.dev31.dist-info/top_level.txt,sha256=XSsjgPA8Ggf9TqKVbkwSqZFuPlZ085X13M9orDycE20,7
79
- locust-2.29.1.dev31.dist-info/RECORD,,
74
+ locust-2.29.1.dev34.dist-info/LICENSE,sha256=78XGpIn3fHVBfaxlPNUfjVufSN7QsdhpJMRJHv2AFpo,1095
75
+ locust-2.29.1.dev34.dist-info/METADATA,sha256=e5FxTmyepgg_kDpLKwq-OgLmi70r3ykCX4NxCfh4YU4,7390
76
+ locust-2.29.1.dev34.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
77
+ locust-2.29.1.dev34.dist-info/entry_points.txt,sha256=RAdt8Ku-56m7bFjmdj-MBhbF6h4NX7tVODR9QNnOg0E,44
78
+ locust-2.29.1.dev34.dist-info/top_level.txt,sha256=XSsjgPA8Ggf9TqKVbkwSqZFuPlZ085X13M9orDycE20,7
79
+ locust-2.29.1.dev34.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.1.0)
2
+ Generator: setuptools (70.1.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5