Skip to main content

Util package to drive Salesforce Oauth Web flow for testing.

Project description

A bit of Requests driven utility code to drive the Oauth2 Web flow. Use this module to login to a Salesforce account using just the username and password. Good for tests and scripts which need Salesforce access_token access.


pip install salesforce-oauth-request-yplan


You need a Connected App defined in Salesforce so that you have all these pieces of info:

  1. client ID
  2. client secret
  3. redirect uri

Now you can get an access_token and instance_url like this:

import salesforce_oauth_request

result = salesforce_oauth_request.login(username=username,

print "Access token:  {}".format(result['access_token'])
print "Refresh token: {}".format(result['refresh_token'])
print "Instance URL:  {}".format(result['instance_url'])

# Now use access_token, instance_url for REST, SOAP, or BULK API access.


cache_session=True/False - default False

Pass the option cache_session=true to save the access token to ~.sf_oauth to save time on repeated runs.

sandbox=True/False - default False

Pass sandbox=True to use a sandbox login. ## Testing


1.1.1 (2016-07-14)

  • Brought back HISTORY.rst.
  • Changed package repository url to the fork.

1.1.0 (2016-07-14)

  • Python2 and Python3 compatibility.
  • Forked salesforce-oauth-request-yplan package.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for salesforce-oauth-request-yplan, version 1.1.1
Filename, size File type Python version Upload date Hashes
Filename, size salesforce-oauth-request-yplan-1.1.1.tar.gz (7.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page