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?

  • How is the Pi and the proxy server getting DNS? That is what the error is hinting at. This may help as well stackoverflow.com/questions/9445489/… – Steve Robillard Dec 21 '16 at 9:27
  • I tried typing in 'export https_proxy=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
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.

  • As you suggested, I typed in with username and password. Now, I am getting another error - "Received HTTP cod3 403 after connect" – Abhilash A Dec 21 '16 at 12:50
  • @AbhilashA Then maybe you're trying to download a file you don't have access to? – Dmitry Grigoryev Dec 21 '16 at 13:41
  • Yes, you were right I tried another link and it worked. But, I am not able to load any website using chromium browser in pi – Abhilash A Dec 21 '16 at 15:15
  • @AbhilashA That sounds like an unrelated issue to me. Anyway, did you set up chromium to use your proxy? – Dmitry Grigoryev Dec 21 '16 at 15:35
  • No. I did not. How do I setup chromium to use proxy? – Abhilash A Dec 21 '16 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.