BigW Consortium Gitlab

Commit 4eb76b60 by Forest Godfrey

More fixes

parent 40fae0de
......@@ -17,6 +17,7 @@ class EtsyV2(API):
super(EtsyV2, self).__init__(api_key, key_file, method_cache, log)
def _get_url(self, url, http_method, content_type, body):
print("Getting URL " + str(url))
if self.etsy_oauth_client is not None:
return self.etsy_oauth_client.do_oauth_request(url,
http_method,
......
import oauth2 as oauth
import urllib
from urllib.parse import parse_qsl
from .etsy_env import EtsyEnvProduction
from cgi import parse_qsl
from etsy.etsy_env import EtsyEnvProduction
EtsyOAuthToken = oauth.Token
......@@ -21,7 +21,7 @@ class EtsyOAuthClient(oauth.Client):
def get_request_token(self, **kwargs):
request_token_url = '%s?%s' % (
self.request_token_url, urllib.parse.urlencode(kwargs))
self.request_token_url, urllib.urlencode(kwargs))
resp, content = self.request(request_token_url, 'GET')
return self._get_token(content)
......@@ -43,12 +43,7 @@ class EtsyOAuthClient(oauth.Client):
self.token = self.get_access_token(oauth_verifier)
def do_oauth_request(self, url, http_method, content_type, body):
if (content_type and content_type !=
'application/x-www-form-urlencoded'):
resp, content = self.request(url, http_method, body=body, headers={
'Content-Type': content_type})
else:
resp, content = self.request(url, http_method, body=body)
resp, content = self.request(url, http_method, body=body, headers={ 'Content-Type': content_type } if content_type else None)
if self.logger:
self.logger.debug('do_oauth_request: content = %r' % content)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment