5

My Pi is behind a proxy. I am able to download packages using apt-get command.

However, when I use something like this:

curl https://www.dataplicity.com/iam1o1sx.py | sudo python

There is an error:

Could not resolve host: www.dataplicity.com

I have entered my credentials (user name:password @ proxy) for HTTP, HTTPS and FTP in 10proxy file.

What could the problem be?

techraf
  • 4,319
  • 10
  • 31
  • 42
Abhilash A
  • 71
  • 1
  • 1
  • 3
  • How is the Pi and the proxy server getting DNS? That is what the error is hinting at. This may help as well http://stackoverflow.com/questions/9445489/linux-curl-command-with-proxy – Steve Robillard Dec 21 '16 at 09:27
  • I tried typing in 'export https_proxy=https://your.proxy.server:port/' in the terminal window of pi. Then I tried the same curl command as mentioned in the question. It shows a message " Received http code 407 after connect". – Abhilash A Dec 21 '16 at 10:26
  • You need to authenticate with the proxy. If you are not planning to use curl in the finished product you may be chasing problems that don't exist. as Dimitry pointed out the cause of the error is that curl is not aware of the proxy and the 407 error is because you are not authenticated on the proxy from curl. – Steve Robillard Dec 21 '16 at 10:30

1 Answers1

7

curl has no idea about 10proxy file, which is exclusive to apt package manager.

You should either specify your proxy in http_proxy environment variable, or using --proxy command line switch.

PS. HTTP error 407 means: "Proxy authentication required". Obviously, you forgot to specify your username and password, like this:

export https_proxy=user:password@server:port

Incidentally, if you happen to have special characters like : or @ in your password, you might be interested to know how to encode them.

Dmitry Grigoryev
  • 27,928
  • 6
  • 53
  • 144