Nov-05-2020, 04:19 AM
(Nov-04-2020, 08:45 AM)ndc85430 Wrote: When you call cURL, you're making a POST request, but in your Python code, you're making a GET request (line 8).
ah.... you nailed it. That was it !
Thank you for pointing it out.
Below worked ..
import requests
from requests.auth import HTTPBasicAuth
# Making a get request
url = 'http://slc05ewk.us.oracle.com:8080/ords/hr/_/sql'
sql = 'select sysdate from dual;'
header = {"Content-Type": "application/sql"}
response = requests.post(url, auth = HTTPBasicAuth('testuser1', 'testuser1'), data=sql, headers=header)
# print request object
print(response.text)