I am trying to get a report I created on SalesForce via simple_salesforce library in python. I am able to connect successfully. However, I get invalid session id error, because the link is wrong, that is created by simple_salesforce. The url I am trying to get is different from what simple_salesforce is searching (which is given in the error below).
The link I am trying to get is : "https://gkg-mfsa.lightning.force.com/lightning/r/Report/00O9N000000JwK2UAK/view?queryScope=userFolders"
But the link simple_salesforce is searching is : "https://gkg-mfsa.my.salesforce.com/services/data/v42.0/lightning/r/Report/00O9N000000JwK2UAK/view?queryScope=userFolders" (as given in the error)
How can I get simple_salesforce library to search for the link I am trying to get instead of what it looks for.
from simple_salesforce import Salesforce
sf = Salesforce(username='myUserName',
password='myPassword',
security_token='mySecurityToken',
instance_url = "")
report_id = 'myreportId'
sf.restful("lightning/r/Report/ + reportId + /view?queryScope=userFolders")
output
SalesforceExpiredSession: Expired session for https://gkg-mfsa.my.salesforce.com/services/data/v42.0/lightning/r/Report/00O9N000000JwK2UAK/view?queryScope=userFolders. Response content: [{'message': 'This session is not valid for use with the REST API', 'errorCode': 'INVALID_SESSION_ID'}]