Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Util package to drive Salesforce Oauth Web flow for testing.

Project Description
# Salesforce Oauth Request

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.

## Installation

```pip install salesforce-oauth-request```

## Usage

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: %s" + result['access_token']
print "Refresh token: %s" + result['refresh_token']
print "Instance URL: %s" + result['instance_url']

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

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

You can run the simple test script like this:


It will prompt you for all the values, drive the login, and print the results.
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
salesforce-oauth-request-1.0.6.tar.gz (5.2 kB) Copy SHA256 Checksum SHA256 Source Aug 11, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting