1

I want to run Following Curl Command in Python and I was trying the requests command of python but I am not getting the proper results.

curl -v ftp://ftp.abc.com/File.txt --socks5-hostname socks.abc.com:PORT --user username:password -O

1
  • what do you try to do and why you can not do it in python? Commented Oct 27, 2020 at 12:43

1 Answer 1

1

You can use subprocess.

import subprocess
result = subprocess.run(["curl", "-v", "ftp://ftp.abc.com/File.txt --socks5-hostname socks.abc.com:PORT --user username:password -O"], capture_output=True)
print(result.stdout)

I'm not into web development but this looks like something the requests module should be able to handle.

r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
r.status_code

https://requests.readthedocs.io/en/master/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.