Running following code:
team_instance='https://devdiv.visualstudio.com'
credentials = BasicTokenAuthentication(vsts_pat)
connection = VssConnection(base_url=team_instance, creds=credentials)
core_client = #connection.get_client('vsts.core.v4_0.core_client.CoreClient')
Gives following error:
TypeError Traceback (most recent call last)
/anaconda/envs/py35/lib/python3.5/site-packages/msrest/service_client.py in send(self, request, headers, content, **config)
234 try:
--> 235 session = self.creds.signed_session(self._session)
236 except TypeError: # Credentials does not support session injection
/anaconda/envs/py35/lib/python3.5/site-packages/msrest/authentication.py in signed_session(self, session)
110 session = super(BasicTokenAuthentication, self).signed_session(session)
--> 111 header = "{} {}".format(self.scheme, self.token['access_token'])
112 session.headers['Authorization'] = header
TypeError: string indices must be integers
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
in ()
5 credentials = BasicTokenAuthentication(vsts_pat)
6 connection = VssConnection(base_url=team_instance, creds=credentials)
----> 7 core_client = connection.get_client('vsts.core.v4_1.core_client.CoreClient')
/anaconda/envs/py35/lib/python3.5/site-packages/vsts/vss_connection.py in get_client(self, client_type)
33 if client_type not in self._client_cache:
34 client_class = self._get_class(client_type)
---> 35 self._client_cache[client_type] = self._get_client_instance(client_class)
36 return self._client_cache[client_type]
37
/anaconda/envs/py35/lib/python3.5/site-packages/vsts/vss_connection.py in _get_client_instance(self, client_class)
46
47 def _get_client_instance(self, client_class):
---> 48 url = self._get_url_for_client_instance(client_class)
49 client = client_class(url, self._creds)
50 client.add_user_agent(self._addition_user_agent)
/anaconda/envs/py35/lib/python3.5/site-packages/vsts/vss_connection.py in _get_url_for_client_instance(self, client_class)
56 return self.base_url
57 else:
---> 58 resource_areas = self._get_resource_areas()
59 if resource_areas is None:
60 raise VstsClientRequestError(('Failed to retrieve resource areas '
/anaconda/envs/py35/lib/python3.5/site-packages/vsts/vss_connection.py in _get_resource_areas(self, force)
86 elif not force:
87 logging.debug('File cache miss for resources on: %s', location_client.normalized_url)
---> 88 self._resource_areas = location_client.get_resource_areas()
89 if self._resource_areas is None:
90 # For OnPrem environments we get an empty collection wrapper.
/anaconda/envs/py35/lib/python3.5/site-packages/vsts/location/v4_0/location_client.py in get_resource_areas(self)
70 location_id='e81700f7-3be2-46de-8624-2eb35882fcaa',
71 version='4.0-preview.1',
---> 72 returns_collection=True)
73 return self._deserialize('[ResourceAreaInfo]', response)
74
/anaconda/envs/py35/lib/python3.5/site-packages/vsts/vss_client.py in _send(self, http_method, location_id, version, route_values, query_parameters, content, media_type, returns_collection)
66 location_id=location_id,
67 route_values=route_values,
---> 68 query_parameters=query_parameters)
69 negotiated_version = self._negotiate_request_version(
70 self._get_resource_location(location_id),
/anaconda/envs/py35/lib/python3.5/site-packages/vsts/vss_client.py in _create_request_message(self, http_method, location_id, route_values, query_parameters)
103 def _create_request_message(self, http_method, location_id, route_values=None,
104 query_parameters=None):
--> 105 location = self._get_resource_location(location_id)
106 if location is None:
107 raise ValueError('API resource location ' + location_id + ' is not registered on '
/anaconda/envs/py35/lib/python3.5/site-packages/vsts/vss_client.py in _get_resource_location(self, location_id)
135 def _get_resource_location(self, location_id):
136 if self.config.base_url not in VssClient._locations_cache:
--> 137 VssClient._locations_cache[self.config.base_url] = self._get_resource_locations(all_host_types=False)
138 for location in VssClient._locations_cache[self.config.base_url]:
139 if location.id == location_id:
/anaconda/envs/py35/lib/python3.5/site-packages/vsts/vss_client.py in _get_resource_locations(self, all_host_types)
171 if self._suppress_fedauth_redirect:
172 headers['X-TFS-FedAuthRedirect'] = 'Suppress'
--> 173 response = self._send_request(request, headers=headers)
174 wrapper = self._base_deserialize('VssJsonCollectionWrapper', response)
175 if wrapper is None:
/anaconda/envs/py35/lib/python3.5/site-packages/vsts/vss_client.py in _send_request(self, request, headers, content, **operation_config)
54 logging.debug('Request content: %s', content)
55 response = self._client.send(request=request, headers=headers,
---> 56 content=content, **operation_config)
57 logging.debug('Response content: %s', response.content)
58 if response.status_code < 200 or response.status_code >= 300:
/anaconda/envs/py35/lib/python3.5/site-packages/msrest/service_client.py in send(self, request, headers, content, **config)
235 session = self.creds.signed_session(self._session)
236 except TypeError: # Credentials does not support session injection
--> 237 session = self.creds.signed_session()
238 if self._session is not None:
239 _LOGGER.warning("Your credentials class does not support session injection. Performance will not be at the maximum.")
/anaconda/envs/py35/lib/python3.5/site-packages/msrest/authentication.py in signed_session(self, session)
109 """
110 session = super(BasicTokenAuthentication, self).signed_session(session)
--> 111 header = "{} {}".format(self.scheme, self.token['access_token'])
112 session.headers['Authorization'] = header
113 return session
TypeError: string indices must be integers