0

I'm trying to run the following curl command(making a REST API request to a Spark UI) via python requests 2.7:

curl --socks5-hostname 127.0.0.1:1080 http://website-url:18080/api/v1/applications/

I've tried by the method explained here but it didnt work for me. The curl command on the other hand did.

proxies = {
    'http': 'socks5://127.0.0.1:1080',
}
response = requests.get(url, proxies=proxies)
tangy
  • 3,056
  • 2
  • 25
  • 42
  • the request module in Python 2.7 and Python 3 have different API. So which Python version are you using ? – bhaskarc Jul 17 '17 at 19:42
  • Im using python 2.7 – tangy Jul 17 '17 at 19:42
  • See this question: [how-to-make-python-requests-work-via-socks-proxy](https://stackoverflow.com/questions/12601316/how-to-make-python-requests-work-via-socks-proxy). If this [answer](https://stackoverflow.com/questions/12601316/how-to-make-python-requests-work-via-socks-proxy/15661226#15661226) doesn't work for some reason try this [answer](https://stackoverflow.com/questions/12601316/how-to-make-python-requests-work-via-socks-proxy/33253788#33253788) – t.m.adam Jul 18 '17 at 02:23

1 Answers1

0

use 'socks5h' instead 'socks5'

proxies = {
    'http': 'socks5h://127.0.0.1:1080',
    'http': 'socks5h://127.0.0.1:1080',
}
Arghya Sadhu
  • 41,002
  • 9
  • 78
  • 107
Toha
  • 11
  • 2