I\'m using Rauth for my queries to the Beatport API. I\'m using this working example in PHP as reference.
This PHP code below uses a request token to log in and auth
You should use urlopen to issue requests.
A simple example:
import urllib2
result = urllib2.urlopen("http://www.google.com/")
print result.read()
Read more here: http://docs.python.org/2/library/urllib2.html
Google urlopen code examples, and you will find what you need.
Why not just use requests? http://www.python-requests.org/en/latest/
This library should be able to do what this php code is doing easily.
use pycurl it is a python implementation of lib curl.
import pycurl
c = pycurl.Curl()
c.setopt(pycurl.URL, "http://www.python.org/")
c.setopt(pycurl.HTTPHEADER, ["Accept:"])
...
you can find more examples and documentation here http://pycurl.sourceforge.net/doc/curlobject.html
I wouldn't bother trying to convert PHP code into python, but instead just search for a Python way of getting this answer. A little googling and it looks like this might be a duplicate:
Oauth client initialization in python for tumblr API using Python-oauth2