With Nokogiri i am getting error “initialize': getaddrinfo: No such host is known. (SocketError)”

后端 未结 1 1387
时光取名叫无心
时光取名叫无心 2021-01-23 13:20

I worte the below code, just to start the Nokogiri to mee the requirement and when I ran it for testing got the error:

D:\\WIPData\\Ruby\\Scripts>Nokogiri.rb
         


        
相关标签:
1条回答
  • 2021-01-23 13:45

    It appears you need to configure a proxy. Find out what the proxy URL/Port is for your organization (and whether there needs to be authentication). You may be able to view this information from your browser configuration. In order to use it with your Ruby code, you need to set the HTTP_PROXY environment variable.

    You can set it in Ruby code:

    ENV['HTTP_PROXY'] = 'http://hostname:port'
    

    or if you need authentication:

    ENV['HTTP_PROXY'] = 'http://username:password@hostname:port'
    

    A more permanent solution is to set HTTP_PROXY in your system environment variables.

    0 讨论(0)
提交回复
热议问题