Basic authentication
See original GitHub issueDescribe the bug
Hi guys! Tried to find the answer for my question among the other issues but couldn’t find. I have basic auth in my web application. Could someone send me the example of locustfile.py, how to correctly perform the auth in this case because i have an error all the time ? Tried the following many code in internet but it doesn’t work. I’m getting this error
[2019-10-24 13:15:52,414] ubuntu/INFO/locust.main: Starting web monitor at *:8089
[2019-10-24 13:15:52,414] ubuntu/INFO/locust.main: Starting Locust 0.12.1
[2019-10-24 13:15:56,312] ubuntu/INFO/locust.runners: Hatching and swarming 10 clients at the rate 1 clients/s...
[2019-10-24 13:15:56,388] ubuntu/ERROR/stderr: Traceback (most recent call last):
[2019-10-24 13:15:56,388] ubuntu/ERROR/stderr: File "src/gevent/greenlet.py", line 766, in gevent._greenlet.Greenlet.run
[2019-10-24 13:15:56,388] ubuntu/ERROR/stderr: File "/opt/odoo10/venv-odoo10/local/lib/python2.7/site-packages/locust/runners.py", line 114, in start_locust
[2019-10-24 13:15:56,388] ubuntu/ERROR/stderr: locust().run(runner=self)
[2019-10-24 13:15:56,388] ubuntu/ERROR/stderr: File "/opt/locust/locust/locustfile.py", line 29, in __init__
[2019-10-24 13:15:56,388] ubuntu/ERROR/stderr: super(AtoutConnectBehavior, self).__init__(*args, **kwargs)
[2019-10-24 13:15:56,388] ubuntu/ERROR/stderr: File "/opt/locust/locust/OdooLocust/OdooLocust.py", line 72, in __init__
[2019-10-24 13:15:56,388] ubuntu/ERROR/stderr: self._connect()
[2019-10-24 13:15:56,389] ubuntu/ERROR/stderr: File "/opt/locust/locust/OdooLocust/OdooLocust.py", line 82, in _connect
[2019-10-24 13:15:56,389] ubuntu/ERROR/stderr: self.rpc.check_login()
[2019-10-24 13:15:56,389] ubuntu/ERROR/stderr: File "/opt/odoo10/venv-odoo10/local/lib/python2.7/site-packages/openerplib/main.py", line 243, in check_login
[2019-10-24 13:15:56,389] ubuntu/ERROR/stderr: self.user_id = self.get_service("common").login(self.database, self.login, self.password)
[2019-10-24 13:15:56,389] ubuntu/ERROR/stderr: File "/opt/odoo10/venv-odoo10/local/lib/python2.7/site-packages/openerplib/main.py", line 180, in proxy
[2019-10-24 13:15:56,389] ubuntu/ERROR/stderr: result = self.connector.send(self.service_name, method, *args)
[2019-10-24 13:15:56,389] ubuntu/ERROR/stderr: File "/opt/locust/locust/OdooLocust/OdooLocust.py", line 51, in send
[2019-10-24 13:15:56,389] ubuntu/ERROR/stderr: raise e
[2019-10-24 13:15:56,389] ubuntu/ERROR/stderr: URLError: <urlopen error [Errno 111] Connection refused>
[2019-10-24 13:15:56,389] ubuntu/ERROR/stderr: 2019-10-24T13:15:56Z
Error report
# occurrences Error
--------------------------------------------------------------------------------------------------------------------------------------------
3 Odoo JsonRPC common : login: "URLError(error(111, 'Connection refused'),)"
--------------------------------------------------------------------------------------------------------------------------------------------
My Code
def base_auth(self):
self.client.request(method="GET", url="/", auth=HTTPDigestAuth("admin", "admin"))
on start i call base_auth(self)
Environment settings
- OS: ubuntu 18.04
- Python version: 3.6
- Locust version:
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Basic access authentication - Wikipedia
In the context of an HTTP transaction, basic access authentication is a method for an HTTP user agent (e.g. a web browser) to...
Read more >HTTP authentication - MDN Web Docs - Mozilla
The "Basic" HTTP authentication scheme is defined in RFC 7617, which transmits credentials as user ID/password pairs, encoded using base64.
Read more >Basic Authentication - Swagger
Basic authentication is a simple authentication scheme built into the HTTP protocol. The client sends HTTP requests with the Authorization header that ...
Read more >What is Basic Authentication? - Twilio
Basic Authentication is a method for an HTTP user agent (e.g., a web browser) to provide a username and password when making a...
Read more >What is Basic Authentication? All you need to know - Wallarm
Used widely in HTTP-based communication, basic method is the means of authenticating end-users before granting access to resources or communication. For the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Are you using the default HTTP client on HttpLocust or are you using the client from
FastHttpLocust
, or are you using a custom client?From the error message you receive, it doesn’t sound like it has anything to do with basic auth. It sounds more like you’re having some kind of connection error. Have you tried doing an HTTP request using
curl
from the machine you’re running Locust on, to the server you’re trying to test against?Please provide a minimal reproducible code example if you still believe that this is a bug in Locust.
URLError(error(111, 'Connection refused'),)
doesn’t sound like something related to Basic Auth. What HTTP client are you using?