Skip to content
Snippets Groups Projects
Unverified Commit 04268e93 authored by Marco Ciotola's avatar Marco Ciotola
Browse files

Use urlparse.parse_qs instead of cgi.parse_qs (deprecated)

parent 6078c1c3
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,6 @@ Hacked a bit by Ben Adida (ben@adida.net) so that: ...@@ -6,7 +6,6 @@ Hacked a bit by Ben Adida (ben@adida.net) so that:
- access tokens are looked up with an extra param of consumer - access tokens are looked up with an extra param of consumer
""" """
import cgi
import urllib import urllib
import time import time
import random import random
...@@ -76,7 +75,7 @@ class OAuthToken(object): ...@@ -76,7 +75,7 @@ class OAuthToken(object):
# oauth_token_secret=digg&oauth_token=digg # oauth_token_secret=digg&oauth_token=digg
@staticmethod @staticmethod
def from_string(s): def from_string(s):
params = cgi.parse_qs(s, keep_blank_values=False) params = urlparse.parse_qs(s, keep_blank_values=False)
key = params['oauth_token'][0] key = params['oauth_token'][0]
secret = params['oauth_token_secret'][0] secret = params['oauth_token_secret'][0]
return OAuthToken(key, secret) return OAuthToken(key, secret)
...@@ -270,7 +269,7 @@ class OAuthRequest(object): ...@@ -270,7 +269,7 @@ class OAuthRequest(object):
# util function: turn url string into parameters, has to do some unescaping # util function: turn url string into parameters, has to do some unescaping
@staticmethod @staticmethod
def _split_url_string(param_str): def _split_url_string(param_str):
parameters = cgi.parse_qs(param_str, keep_blank_values=False) parameters = urlparse.parse_qs(param_str, keep_blank_values=False)
for k, v in parameters.iteritems(): for k, v in parameters.iteritems():
parameters[k] = urllib.unquote(v[0]) parameters[k] = urllib.unquote(v[0])
return parameters return parameters
...@@ -287,7 +286,7 @@ class OAuthServer(object): ...@@ -287,7 +286,7 @@ class OAuthServer(object):
self.signature_methods = signature_methods or {} self.signature_methods = signature_methods or {}
def set_data_store(self, oauth_data_store): def set_data_store(self, oauth_data_store):
self.data_store = data_store self.data_store = oauth_data_store
def get_data_store(self): def get_data_store(self):
return self.data_store return self.data_store
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment