Azure / msrest-for-python

The runtime library "msrest" for AutoRest generated Python clients.
MIT License
41 stars 64 forks source link

v0.6.3 breaks vsts package #135

Closed emlynoregan closed 5 years ago

emlynoregan commented 5 years ago

The package vsts uses this package. With msrest v0.6.3 it breaks as follows.

The following code used to work with v0.6.2:

    credentials = BasicAuthentication('', personal_access_token)
    connection = VssConnection(base_url=organization_url, creds=credentials)
    git_client = connection.get_client('vsts.git.v4_1.git_client.GitClient')

Now with msrest v0.6.3 the third line throws this exception:

Traceback (most recent call last):
- File "/var/task/lambda_function.py", line 31, in go
- git_client = connection.get_client('vsts.git.v4_1.git_client.GitClient')
- File "/opt/lib/vsts/vss_connection.py", line 37, in get_client
- self._client_cache[client_type] = self._get_client_instance(client_class)
- File "/opt/lib/vsts/vss_connection.py", line 50, in _get_client_instance
- url = self._get_url_for_client_instance(client_class)
- File "/opt/lib/vsts/vss_connection.py", line 60, in _get_url_for_client_instance
- resource_areas = self._get_resource_areas()
- File "/opt/lib/vsts/vss_connection.py", line 90, in _get_resource_areas
- self._resource_areas = location_client.get_resource_areas()
- File "/opt/lib/vsts/location/v4_0/location_client.py", line 71, in get_resource_areas
- version='4.0-preview.1')
- File "/opt/lib/vsts/vss_client.py", line 71, in _send
- query_parameters=query_parameters)
- File "/opt/lib/vsts/vss_client.py", line 110, in _create_request_message
- location = self._get_resource_location(location_id)
- File "/opt/lib/vsts/vss_client.py", line 140, in _get_resource_location
- VssClient._locations_cache[self.config.base_url] = self._get_resource_locations(all_host_types=False)
- File "/opt/lib/vsts/vss_client.py", line 176, in _get_resource_locations
- response = self._send_request(request, headers=headers)
- File "/opt/lib/vsts/vss_client.py", line 63, in _send_request
- self._handle_error(request, response)
- File "/opt/lib/vsts/vss_client.py", line 238, in _handle_error
- raise VstsServiceError(wrapped_exception)
vsts.exceptions.VstsServiceError: TF400813: The user '' is not authorized to access this resource.

I am installing packages using pip, with a requirements.txt file with just one line:

vsts

Workaround: Change requirements.txt file to the following:

msrest==0.6.2
vsts
lmazuel commented 5 years ago

Was solved in 0.6.4