[Python] Can connect via Postman but not via python script

Discussão em 'Python' iniciado por Stack, Fevereiro 22, 2025.

  1. Stack

    Stack Membro Participativo

    I am helping my client to solve a problem. He tries to call my API but is unsuccessful.

    Situation:

    • my API is accessible via postman and the browser (swagger). It works.
    • On the same computer via a python script I cannot access to the API
    error:


    Caused by NewCOnnectionError('<urllib3.connection.HTTPConnection object at 0x000001310A6F5C0>:
    Failed to establish a new connection: [Errno 11001] getaddrinfo failed')
    ​

    If I try a very simple script

    import requests
    r = requests.get('http://google.com')


    I get the same error.

    I assume there some problem with firewall/proxy but why does Postman work? In which direction can I direct my client to solve problem?

    I also tried ping and it doesn't work either:

    $ ping www.google.com

    Ping request could not found host www.google.com. Pleas check the name and try again.

    Continue reading...

Compartilhe esta Página