skip to navigation
skip to content

Not Logged In

salesforce-oauth-request 1.0.6

Util package to drive Salesforce Oauth Web flow for testing.

# Salesforce Oauth Request

A bit of Requests driven utility code to drive the Salesforce.com 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,
password=password,
client_id=client_id,
client_secret=client_secret,
redirect_uri=redirect_uri)

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:

```python test.py```

It will prompt you for all the values, drive the login, and print the results.  
File Type Py Version Uploaded on Size
salesforce-oauth-request-1.0.6.tar.gz (md5) Source 2014-08-11 5KB
  • Downloads (All Versions):
  • 11 downloads in the last day
  • 141 downloads in the last week
  • 584 downloads in the last month
  • Author: Scott Persinger
  • Home Page: https://github.com/heroku/salesforce-oauth-request
  • License:
    Copyright (c) 2013 Scott Persinger
    
    MIT License
    
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
    "Software"), to deal in the Software without restriction, including
    without limitation the rights to use, copy, modify, merge, publish,
    distribute, sublicense, and/or sell copies of the Software, and to
    permit persons to whom the Software is furnished to do so, subject to
    the following conditions:
    
    The above copyright notice and this permission notice shall be
    included in all copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Package Index Owner: scottpersinger
  • DOAP record: salesforce-oauth-request-1.0.6.xml