Skip to content

Commit

Permalink
add proxy_host and proxy_port for FastHttpUser
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Adrian committed Jun 10, 2024
1 parent 3d21691 commit a665132
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/increase-performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ FastHttpUser class
--------------------

.. autoclass:: locust.contrib.fasthttp.FastHttpUser
:members: network_timeout, connection_timeout, max_redirects, max_retries, insecure, concurrency, client_pool, rest, rest_
:members: network_timeout, connection_timeout, max_redirects, max_retries, insecure, proxy_host, proxy_port, concurrency, client_pool, rest, rest_


FastHttpSession class
Expand Down
2 changes: 2 additions & 0 deletions examples/fast_http_locust.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class WebsiteUser(FastHttpUser):
# max_redirects = 5
# max_retries = 1
# network_timeout = 60.0
# proxy_host = my-proxy.com
# proxy_port = 8080

@task
def index(self):
Expand Down
8 changes: 8 additions & 0 deletions locust/contrib/fasthttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ class FastHttpUser(User):
Note that setting this value has no effect when custom client_pool was given, and you need to spawn a your own gevent pool
to use it (as Users only have one greenlet). See test_fasthttp.py / test_client_pool_concurrency for an example."""

proxy_host: str | None = None
"""Parameter passed to FastHttpSession"""

proxy_port: int | None = None
"""Parameter passed to FastHttpSession"""

client_pool: HTTPClientPool | None = None
"""HTTP client pool to use. If not given, a new pool is created per single user."""

Expand Down Expand Up @@ -355,6 +361,8 @@ def __init__(self, environment) -> None:
client_pool=self.client_pool,
ssl_context_factory=self.ssl_context_factory,
headers=self.default_headers,
proxy_host=self.proxy_host,
proxy_port=self.proxy_port,
)
"""
Instance of HttpSession that is created upon instantiation of User.
Expand Down

0 comments on commit a665132

Please sign in to comment.