Created
May 13, 2011 04:45
-
-
Save smalyshev/969984 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import urlparse | |
| import oauth2 as oauth | |
| import urllib | |
| import sys | |
| import json | |
| from pymongo import json_util | |
| consumer_key = 'CONSUMERKEY' | |
| consumer_secret = 'CONSUMERSECRET' | |
| acc_token = 'bf1492236fbe' | |
| acc_secret = '5b05d09a0b7e' | |
| url = 'http://localhost:8888/sugar63/service/v5/rest.php' | |
| restparams = { | |
| 'input_type': 'json', | |
| 'request_type': 'json', | |
| 'response_type': 'json', | |
| 'method':'', | |
| } | |
| consumer = oauth.Consumer(consumer_key, consumer_secret) | |
| token = oauth.Token(acc_token, acc_secret) | |
| client = oauth.Client(consumer, token) | |
| restparams['method'] = 'get_available_modules' | |
| resp, content = client.request(url, "POST", body=urllib.urlencode(restparams)) | |
| print resp | |
| print content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment