Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proxy support for FastHttpUser #2758

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add proxy_host and proxy_port for FastHttpUser
  • Loading branch information
Nicolas Adrian committed Jun 10, 2024
commit a665132b230de39f16306536f803d525984427ed
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
Loading