Yes, this has been working for me. I'm using the python oauth library
you get with easy_install (there are others, which is confusing).
from restclient import RestClient
req = _signed_request(
consumer, token=accessToken,
http_method="GET",
http_url='http://twitter.com/account/verify_credentials.json',
)
oauthHeader = req.to_header()['Authorization']
ret = RestClient().post(
"http://tipjoy.com/api/createTwitterAccount/", path="",
body=urllib.urlencode(dict(
twitter_username=str(graph.value(user, TW.screen_name)),
twitter_oauth_header=oauthHeader)),
headers=uaHeader)
ret = jsonlib.loads(ret)
if ret['result'] != 'success':
raise ValueError(ret['reason'])
_signed_request is also mine:
from oauth.oauth import OAuthRequest, OAuthConsumer, OAuthToken
from oauth.oauth import OAuthSignatureMethod_HMAC_SHA1
def _signed_request(consumer, token=None, **oauth_request_kw):
"""
the other named args are
http_method='GET', http_url=None, parameters=None
"""
req = OAuthRequest.from_consumer_and_token(
consumer, token=token, **oauth_request_kw)
req.sign_request(OAuthSignatureMethod_HMAC_SHA1(), consumer, token)
return req