net/http.rb:560:in `initialize': getaddrinfo: Name or service not known (SocketError)

前端 未结 2 1179
梦谈多话
梦谈多话 2021-01-02 09:50
@@timestamp = nil

def generate_oauth_url
  @@timestamp = timestamp
  url = CONNECT_URL + REQUEST_TOKEN_PATH + \"&oauth_         


        
2条回答
  •  [愿得一人]
    2021-01-02 10:16

    "Name or service not known" is a socket-level error which usually points to either an invalid IP address/DNS hostname, or an unregistered port name (e.g. telnet the.host.name service where service is not a registered service name.)

    Check that CONNECT_URL holds a valid URL.

    EDIT: I'm not a Ruby programmer, but I wouldn't mind betting that Net::HTTP.new requires a hostname (e.g. www.facebook.com) as the first argument, not a complete URL (e.g. www.facebook.com/login.php?method=oauth).

提交回复
热议问题