Skip to content

Instantly share code, notes, and snippets.

@smalyshev
Created May 13, 2011 04:45
Show Gist options
  • Select an option

  • Save smalyshev/969984 to your computer and use it in GitHub Desktop.

Select an option

Save smalyshev/969984 to your computer and use it in GitHub Desktop.
#!/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