This is the command I am running in bash
:
curl -d "username=xxxxxx" -d "password=xxxxx" <<address>> --insecure --silent
How can I run this using Python?
This is the command I am running in bash
:
curl -d "username=xxxxxx" -d "password=xxxxx" <<address>> --insecure --silent
How can I run this using Python?
Try Subprocess
:
import subprocess
# ...
subprocess.call(["curl -d \"username=xxxxxx\" -d \"password=xxxxx\" https://xxxxx.com/logreg/login/ --insecure --silent" , shell=True)
I did not try what I wrote, but the essential is here.
Check this page for more info : Subprocess management
I hope you don't want to explicitly run curl
, but you just want to get the same result.
>>> import requests
>>> r = requests.get('https://example.com', auth=('user', 'pass'), verify=False)
>>> print(r.status_code)
200