Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion msgraphcore/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
REQUEST_TIMEOUT = 100
CONNECTION_TIMEOUT = 30
BASE_URL = 'https://graph.microsoft.com/v1.0'
BASE_URL = 'https://graph.microsoft.com/'
SDK_VERSION = '0.0.3'

# Used as the key for AuthMiddlewareOption in MiddlewareControl
Expand Down
5 changes: 3 additions & 2 deletions msgraphcore/graph_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ class GraphSession(Session):
def __init__(self,
credential: TokenCredential,
scopes: [str] = ['.default'],
middleware: list = []
middleware: list = [],
api_version: str = 'v1.0'
):
super().__init__()
self._append_sdk_version()
self._base_url = BASE_URL
self._base_url = BASE_URL + '/' + api_version

auth_handler = AuthorizationHandler(credential, scopes)

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_graph_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_creates_instance_of_session(self):
self.assertIsInstance(self.requests, Session)

def test_has_graph_url_as_base_url(self):
self.assertEqual(self.requests._base_url, BASE_URL)
self.assertNotEqual(self.requests._base_url, BASE_URL)

def test_has_sdk_version_header(self):
self.assertTrue('sdkVersion' in self.requests.headers)
Expand All @@ -37,7 +37,7 @@ def test_initialized_with_middlewares(self):

@responses.activate
def test_builds_graph_urls(self):
graph_url = BASE_URL+'/me'
graph_url = self.requests._base_url + '/me'
responses.add(responses.GET, graph_url, status=200)

self.requests.get('/me')
Expand Down