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 authenticate for 3-legged auth
ini_set('max_execution_time', 500);
$submit = "Login";
$url = $auth_submiturl;
$curl_connection_bp = curl_init();
curl_setopt($curl_connection_bp, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_connection_bp, CURLOPT_URL, $url);
curl_setopt($curl_connection_bp, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($curl_connection_bp, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT6.0; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11");
curl_setopt($curl_connection_bp, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl_connection_bp, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection_bp, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl_connection_bp, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_connection_bp, CURLOPT_VERBOSE, false); // when true, this outputs the oauth_token and oauth_verifier value that are posted to the callback URL
curl_setopt($curl_connection_bp, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($curl_connection_bp, CURLOPT_REFERER, $curl_connection_bp);
curl_setopt($curl_connection_bp, CURLOPT_FAILONERROR, 0);
$post_string = 'oauth_token='.$request_token_info['oauth_token'] . '&username=' . $beatport_login . '&password=' . $beatport_password . '&submit=Login';
curl_setopt($curl_connection_bp, CURLOPT_POST, true);
curl_setopt($curl_connection_bp, CURLOPT_POSTFIELDS, $post_string);
$beatport_response = curl_exec($curl_connection_bp);
$beatport_response = json_decode($beatport_response);
print_r($beatport_response);
How can I achieve this in Python? I think I need to use urllib, but I can't understand the PHP code.