Python Forum
Calling Oracle REST SQL from Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling Oracle REST SQL from Python
#3
Thumbs Up 
(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)
Reply


Messages In This Thread
Calling Oracle REST SQL from Python - by johnjacob - Nov-04-2020, 05:22 AM
RE: Calling Oracle REST SQL from Python - by johnjacob - Nov-05-2020, 04:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python script is hanging while calling a procedure in database prasanthi417 4 526 Jan-17-2024, 02:33 PM
Last Post: deanhystad
  PyRun_SimpleFile calling multiprocessing Python Class cause endless init loop Xeno 2 1,057 Sep-19-2022, 02:32 AM
Last Post: Xeno
  API REST Package for Calling/Flask muzikman 12 4,265 Oct-22-2021, 07:51 PM
Last Post: muzikman
  Encrypting Oracle Passwords / Python Library for That? bmccollum 1 2,603 Jun-11-2021, 07:59 PM
Last Post: Larz60+
  Calling python from c++ in visual studio pdk5 0 2,176 May-24-2021, 10:18 AM
Last Post: pdk5
  Python to Oracle Conn Issue chvsnarayana 2 40,032 Sep-06-2020, 04:33 PM
Last Post: Larz60+
Bug maximum recursion depth exceeded while calling a Python object error in python3 Prezess 4 3,785 Aug-02-2020, 02:21 PM
Last Post: deanhystad
  Conversion of Oracle PL/SQL(packages, functions, procedures) to python modules. DivyaKumar 2 6,525 Jul-09-2020, 04:46 PM
Last Post: srikanth7482
  Load table from Oracle to MYSQL using python himupant94 0 1,661 May-12-2020, 04:50 PM
Last Post: himupant94
  Parse a REST API call using Python GKT 1 1,915 May-07-2020, 04:15 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020