Skip to content

Commit

Permalink
Merge pull request googleapis#103 from Psynbiotik/master
Browse files Browse the repository at this point in the history
Add the ability to specify default headers used in future requests.
  • Loading branch information
Narcolapser authored Jul 20, 2018
2 parents 9ef839b + 90120a8 commit ff01f85
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions O365/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def delete_token(token_path=None):
class Connection(with_metaclass(Singleton)):
_oauth2_authorize_url = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
_oauth2_token_url = 'https://login.microsoftonline.com/common/oauth2/v2.0/token'
default_headers = None

def __init__(self):
""" Creates a O365 connection object """
Expand Down Expand Up @@ -196,6 +197,8 @@ def get_response(request_url, **kwargs):
con_params = {}
if connection.proxy_dict:
con_params['proxies'] = connection.proxy_dict
if connection.default_headers:
con_params['headers'] = connection.default_headers
con_params.update(kwargs)

log.info('Requesting URL: {}'.format(request_url))
Expand Down

0 comments on commit ff01f85

Please sign in to comment.