-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting non-json REST endpoints #264
base: master
Are you sure you want to change the base?
Conversation
…dundant path segments
Added r' prefix to regex string
Added r' prefix to regex string
I would like to see some more feedback from the community before doing anything with this one. I'm concerned that we are now returning two types and that may break downstream code. Personally i'm starting to lean towards having most of these API calls return the I would also need to see tests written for this before I'd be willing to merge. |
@@ -299,16 +302,16 @@ def restful(self, path, params=None, method='GET', **kwargs): | |||
* method: HTTP request method, default GET | |||
* other arguments supported by requests.request (e.g. json, timeout) | |||
""" | |||
|
|||
url = self.base_url + path | |||
base_regex = r'\/*services\/data\/v[0-9]{2}.[0-9]{1,}\/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is something that you really should consider to merge since resources URIs include "services/data/vXX.X" in it, so if any tries to search any resource using the URI returned in a previous call it will not work as it now assumes resources URIs dont include the services/data/vXX.X part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not opposed to merging this in just need to review it.
When entering a rest URL in the
restful
function, it automatically returns the parsed json response. For downloading files from Salesforce, e.g., ContentDocumentVersion, the response is ofContent-Type: application/octet-stream
(interestingly, the real value in the response header from Salesforce is application/octetstream, in contrast to their documentation).The changed
restful
function now reads the Content-Type value and parses the json forContent-Type: application/json
and returns an unparsed response for all other Content-Type values.When querying ContentDocumentVersion, the response from Salesforce is a REST path which includes the
/services/data/vXX.X/
prefix. To provide a fluent usage of simple-salesforce with other applications, therestful
function now accepts the prefix, and removes it by using a regex.