Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions intuitlib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ def __init__(self, client_id, client_secret, redirect_uri, environment, state_to
self.x_refresh_token_expires_in = None
self.id_token = id_token

def setAuthorizeURLs(self, urlObject):
"""Set authorization url using custom values passed in the data dict
:param **data: data dict for custom authorizationURLS
:return: self
"""
if urlObject is not None:
self.auth_endpoint = urlObject['auth_endpoint']
self.token_endpoint = urlObject['token_endpoint']
self.revoke_endpoint = urlObject['revoke_endpoint']
self.user_info_url = urlObject['user_info_url']
return None

def get_authorization_url(self, scopes, state_token=None):
"""Generates authorization url using scopes specified where user is redirected to

Expand Down
1 change: 1 addition & 0 deletions intuitlib/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Scopes(Enum):
PAYROLL = 'com.intuit.quickbooks.payroll'
PAYROLL_TIMETRACKING = 'com.intuit.quickbooks.payroll.timetracking'
PAYROLL_BENEFITS = 'com.intuit.quickbooks.payroll.benefits'
PAYSLIP_READ = 'com.intuit.quickbooks.payroll.payslip.read'

# For migrated apps only
# To not see consent page they should pass the following scopes - openid intuit_name email
Expand Down
13 changes: 7 additions & 6 deletions intuitlib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,22 @@

def get_discovery_doc(environment, session=None):
"""Gets discovery doc based on environment specified.

:param environment: App environment, accepted values: 'sandbox','production','prod','e2e'
:param session: `requests.Session` object if a session is already being used, defaults to None
:return: Discovery doc response
:raises HTTPError: if response status != 200
"""

if environment.lower() in ['production', 'prod']:
discovery_url = DISCOVERY_URL['production']
else:
elif environment.lower() in ['sandbox', 'sand']:
discovery_url = DISCOVERY_URL['sandbox']


response = requests.get(url=discovery_url, headers={'User-Agent': 'Mozilla/5.0'})
else:
discovery_url = environment

if session is not None and isinstance(session, Session):
response = session.get(url=discovery_url)
else:
response = requests.get(url=discovery_url)
if response.status_code != 200:
raise AuthClientError(response)
return response.json()
Expand Down
2 changes: 1 addition & 1 deletion intuitlib/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '1.2.3'
__version__ = '1.2.4'