From 991e2c2faadc06d9bfa43de99df792d8fbd02d18 Mon Sep 17 00:00:00 2001 From: orent Date: Mon, 28 Nov 2022 19:43:46 +0200 Subject: [PATCH] Python 2.7 compatibility (#1087) --- atlassian/bamboo.py | 2 +- atlassian/bitbucket/cloud/repositories/__init__.py | 2 +- atlassian/rest_client.py | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/atlassian/bamboo.py b/atlassian/bamboo.py index daea1681e..a5248855e 100755 --- a/atlassian/bamboo.py +++ b/atlassian/bamboo.py @@ -369,7 +369,7 @@ def results( elements_key="results", element_key="result", label=label, - **params, + **params ) def latest_results( diff --git a/atlassian/bitbucket/cloud/repositories/__init__.py b/atlassian/bitbucket/cloud/repositories/__init__.py index c789784fb..b932b856d 100644 --- a/atlassian/bitbucket/cloud/repositories/__init__.py +++ b/atlassian/bitbucket/cloud/repositories/__init__.py @@ -254,7 +254,7 @@ def __init__(self, data, *args, **kwargs): self.__commits = Commits( "{}/commits".format(self.url), data={"links": {"commit": {"href": "{}/commit".format(self.url)}}}, - **self._new_session_args, + **self._new_session_args ) self.__default_reviewers = DefaultReviewers("{}/default-reviewers".format(self.url), **self._new_session_args) self.__issues = Issues("{}/issues".format(self.url), **self._new_session_args) diff --git a/atlassian/rest_client.py b/atlassian/rest_client.py index 5c17b6402..a195b914a 100644 --- a/atlassian/rest_client.py +++ b/atlassian/rest_client.py @@ -3,7 +3,10 @@ from json import dumps import requests -from oauthlib.oauth1 import SIGNATURE_RSA_SHA512 +try: + from oauthlib.oauth1 import SIGNATURE_RSA_SHA512 as SIGNATURE_RSA +except ImportError: + from oauthlib.oauth1 import SIGNATURE_RSA_SHA512 from requests import HTTPError from requests_oauthlib import OAuth1, OAuth2 from six.moves.urllib.parse import urlencode @@ -103,7 +106,7 @@ def _create_oauth_session(self, oauth_dict): oauth = OAuth1( oauth_dict["consumer_key"], rsa_key=oauth_dict["key_cert"], - signature_method=SIGNATURE_RSA_SHA512, + signature_method=SIGNATURE_RSA, resource_owner_key=oauth_dict["access_token"], resource_owner_secret=oauth_dict["access_token_secret"], )