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 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.
```
## 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.
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.
```
## 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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for salesforce-oauth-request-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e230341783055607f57304190cb53a1c048f0eea527ba783fe2da0d57c729e8 |
|
MD5 | 0e30bdaa2fe03b8bd692361d5fc65416 |
|
BLAKE2b-256 | aa3c9fcf5c74507d8ca11bcae34b32640b341b788bd4cb9951daad620858fad6 |
Close
Hashes for salesforce-oauth-request-1.0.0.macosx-10.8-x86_64.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | af13988aadb4ecee1f6b24098c59087c2f0e58684790a66d6cf4207c71a52c4f |
|
MD5 | 18926ab2134e3a813d8fe6835b9f7dc5 |
|
BLAKE2b-256 | 325e03a30e438b1d61e5bf435af94b1e7f0a767c683bc2545f63709b32e112a1 |