Failure to authenticate REST API connection
Publié : lun. août 17, 2026 11:16 pm
Several years ago I wrote some Python to access our Squash instance via the REST API, and it worked well for the need we had at the time.
Then it sat dormant for a while, as we didn't need that functionality.
Then we got bought by a different company, and our Squash instance moved to a different URL. In the process, our IT team updates our squash to `14.0.3.RELEASE`.
Now, when I try to run my same Python script, I'm getting a 401 error, even when I type a known-good username and password from a Linux command line.
Viewing Squash in the browser, my URL is `http://<our_domain>/squash/campaign-workspace`
My Python code is calling to `http://<our_domain>/squash/api/rest/latest/projects?projectName=<our_project>`
The invocation is being done as:
I see here (https://www.squashtm.com/en/post/releas ... -available) that as of 2024, there's supposed to be the ability to authenticate with a token rather than username/password. But I also see here (https://tm-en.doc.squashtest.com/latest ... index.html) that this functionality isn't expected until August of 2027 (release 19.0), and I can't find the described means to generate a token for a user. So, I'm guessing that user/password authentication should still be valid.
I can log into directly Squash using the username and password, but it fails when I try to make the API connection.
As part of our transition, we did lose our https certificate for Squash. Now I'm hitting squash `http` rather than `https`. Does this have anything to do with it? If not, what's likely to be my problem here? Three years ago, my Python script ran flawlessly.
Thanks!
Then it sat dormant for a while, as we didn't need that functionality.
Then we got bought by a different company, and our Squash instance moved to a different URL. In the process, our IT team updates our squash to `14.0.3.RELEASE`.
Now, when I try to run my same Python script, I'm getting a 401 error, even when I type a known-good username and password from a Linux command line.
Viewing Squash in the browser, my URL is `http://<our_domain>/squash/campaign-workspace`
My Python code is calling to `http://<our_domain>/squash/api/rest/latest/projects?projectName=<our_project>`
The invocation is being done as:
Code : Tout sélectionner
import requests
AUTH = (user, password)
response = requests.get(url, auth=AUTH)
I can log into directly Squash using the username and password, but it fails when I try to make the API connection.
As part of our transition, we did lose our https certificate for Squash. Now I'm hitting squash `http` rather than `https`. Does this have anything to do with it? If not, what's likely to be my problem here? Three years ago, my Python script ran flawlessly.
Thanks!