-2

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?

jwpfox
  • 5,124
  • 11
  • 45
  • 42

2 Answers2

0

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

Floran Gmehlin
  • 824
  • 1
  • 11
  • 34
0

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
Pavel Gurkov
  • 737
  • 5
  • 14