function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
irfan azizirfan aziz 

Is it possible to do the SOAP API login with requests python library?

Trying to do the curl bulk steps in python. I can do the login via postman which returns the Session ID but when i try to run the code in python, it keeps executing without finnishing nor giving any error.  However, i am able to create a job using the session id from the postman post.
Here is the code. Any suggestion?
import requests  as r
url1='https://login.salesforce.com/services/Soap/u/39.0'
header1={'Content-Type':'text/xml; charset=UTF-8','SOAPAction':'login'}
body1=open('login.txt','r')
resp1=r.post(url1,headers=header1,data=body1)
print resp1.status_code

 
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Irfan,

To send authenticated REST request with Python Please refer the below link for reference. Hope it will be helpful.

Best Regards
Rahul Kumar