[Python] Google's Code for running the tests on the server doesn't seem to work

Discussão em 'Python' iniciado por Stack, Maio 14, 2025.

  1. Stack

    Stack Membro Participativo

    curl -X POST http://0.0.0.0:8000/apps/my_sample_agent/users/u_123/sessions/s_123
    -H "Content-Type: application/json"
    -d '{"state": {"key1": "value1", "key2": 42}}'

    When I paste the above code as is, it returns a few errors, the first ones being

    curl: (7) Failed to connect to 0.0.0.0 port 8000 after 0 ms: Could not connect to server curl: (3) URL rejected: Bad hostname

    The rest are about how -H and -d are not cmdlets etc

    Below is some of what I have done in an attempt to get the code to work:

    1. Wrapping the 42 in double quotes thinking it is a syntax error
    2. Replacing the address with localhost:8000, as my research indicated that apparently 0.0.0.0:8000 is not a valid address, and I need to use localhost:8000 or 127.0.0.1:8000 instead.
    3. Putting the code all on one line.
    4. Running in a ps1, bash and even json file using both VS Code's terminal and my local terminal (Powershell and CMD for both).

    I am supposed to get a success message with a log of the session, but instead I keep getting the above error message in my terminals, and {"detail":"Not Found"} on the localhost:8000 and 127.0.0.1:8000, and "It looks like the webpage at http://0.0.0.0:8000/ might be having issues, or it may have moved permanently to a new web address." on 0.0.0.0:8000.

    Continue reading...

Compartilhe esta Página