TestProject Forum
Powered by leading experts in the test automation community

Python SDK response from agent 404

I have been following the webinar to setup python sdk in my machine.

I setup the environmet variable TP_DEV_TOKEN, (close the terminal and reopen), and I can see it when I output it with echo. I confirmed that the token is the provided here: https://app.testproject.io/#/integrations/sdk.

My agent is running, and I have even tried restarting it. If I go to the provided URL (localhost with port 8585) it show this:

TestProject Agent (0.62.14) on LXVXD2PKJGH6 (Mac OS X)
Installation path: /Applications/TestProject Agent.app/Contents/Resources
Data path: /Users/felipe/Library/Application Support/TestProject/Agent
IPs: 10.0.0.250
Registered: Yes (111862)
Authorized: Yes (f_24kjjC-0GWktEYcn_rjA)
Alias: Felipe’s Machine

The error I’m getting is this:
root:agent_client.py:269 Failed to initialize a session with the Agent

root:agent_client.py:270 Response from Agent: 404 Client Error: Not Found for url: http://127.0.0.1:8585//api/development/session

note that I’m using the default TP_AGENT_URL. I do have the variable setup to be localhost 8585, but I also tried removing it.

Anybody knows how to fix this? Thanks!

Hello @fecenteno.

Can you please update your agent to the latest version and try again?

@david.goichman ok thanks for looking at this. I just did, but I got the same result:

root:agent_client.py:269 Failed to initialize a session with the Agent
root:agent_client.py:270 Response from Agent: 404 Client Error: Not Found for url: http://127.0.0.1:8585//api/development/session

By the way, I just tried going to that URL, and I do get a 404 error. I’m not sure where that’s being constructed, but it does seem odd the double “//”.

However, if I just go to http://127.0.0.1:8585, it works fine:

TestProject Agent (0.63.9) on LXVXD2PKJGH6 (Mac OS X)
Installation path: /Applications/TestProject Agent.app/Contents/Resources
Data path: /Users/felipe/Library/Application Support/TestProject/Agent
IPs: 10.0.0.250
Registered: Yes (111862)
Authorized: Yes (f_24kjjC-0GWktEYcn_rjA)
Alias: Felipe’s Machine

Can you please post you driver initialization code snippet?
Do you set the URL value as http://127.0.0.1:8585 or http://127.0.0.1:8585/ with a trailing slash?

1 Like

@marat yep, that was it…

I typed the URL to chrome to make sure it was the right one, then copied from there so that I wouldn’t have any typos. I didn’t realize the browser added a trailing ‘/’.

Thanks guys, sorry that was a rookie mistake :sweat_smile:

That’s fine, no worries, Thanks for reporting this, I will report the issue on our GitHub repository (https://github.com/testproject-io/python-sdk) for the SDK to handle this scenarios (removing the extra slash).

1 Like

For a reference: https://github.com/testproject-io/python-sdk/issues/44