Download / Scrape Salesforce Reports in 4 lines of Python

Python Code:

import requests
l = requests.get("https://login.salesforce.com/?un=USERNAME&pw=PASSWORD")
d = requests.get("https://na3.salesforce.com/REPORT_ID?view=d&snip&export=1&enc=UTF-8&xf=csv",cookies=l.cookies)
print d.content

References:

http://sfdc-heretic.warped-minds.com/2006/04/10/progmatic-access-to-salesforcecom-reports/

http://docs.python-requests.org/en/latest/user/quickstart/#cookies

http://www.techsmog.com/index.php/2011/02/08/parsing-real-time-salesforce-com-reports-via-perlcgi-html-tables/

About brendansterne

Director of Innovation Labs, Indeed.com
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s