For an Attachment sobject, there is a 'Body' field, whose value looks like: /services/data/v39.0/sobjects/Attachment/00Q5700000v3mCFREE/Body.

When I make a GET request to this endpoint using Python requests package, the download speed is roughly 50 kilobytes/second. (For content with 'BodyLength': 5323002, which Salesforce documentation says is the size of the file, in bytes, it took 104 seconds. Other files showed similar download rates.)

I'm wondering if there is something about this endpoint which limits the speed you can download the content. I know bandwidth and speed of my network affect this, but my internet speed is well more than 50 KB/s, and the download speeds from this endpoint are this slow whether making the request from my local machine or from a dedicated machine in AWS.

Is this speed expected, and is there a preferred way to get the file content faster?

  • The slowness actually came from my handling of the response in Python. The requests download is very fast. But I have a function which attempts to parse the response as json, and if it gets a ValueError, then take the response's raw content (file downloads will always be the ValueError / raw content case). For whatever reason, it takes a very long time (all the time described in my question) before going into the except branch after failing the .json() parsing.
    – tscizzle
    May 16, 2017 at 22:31
  • maybe you can post this as your answer =)
    – glls
    May 16, 2017 at 22:47


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.