Skip to content

Commit 2d21758

Browse files
authored
Merge pull request #139 from Microsoft/dev
0.20.0, bump dependency of msrest to > 0.6.0
2 parents bf17519 + 5765e7e commit 2d21758

File tree

5 files changed

+27
-21
lines changed

5 files changed

+27
-21
lines changed

vsts/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from setuptools import setup, find_packages
77

88
NAME = "vsts"
9-
VERSION = "0.1.19"
9+
VERSION = "0.1.20"
1010

1111
# To install the library, run the following
1212
#
@@ -16,7 +16,7 @@
1616
# http://pypi.python.org/pypi/setuptools
1717

1818
REQUIRES = [
19-
"msrest>=0.5.0,<0.6.0"
19+
"msrest>=0.6.0,<0.7.0"
2020
]
2121

2222
CLASSIFIERS = [

vsts/vsts/git/v4_0/git_client.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# --------------------------------------------------------------------------
77

88

9-
from msrest.pipeline import ClientRequest
9+
from msrest.universal_http import ClientRequest
1010
from .git_client_base import GitClientBase
1111

1212

@@ -21,9 +21,8 @@ def __init__(self, base_url=None, creds=None):
2121
super(GitClient, self).__init__(base_url, creds)
2222

2323
def get_vsts_info(self, relative_remote_url):
24-
request = ClientRequest()
25-
request.url = self._client.format_url(relative_remote_url.rstrip('/') + '/vsts/info')
26-
request.method = 'GET'
24+
url = self._client.format_url(relative_remote_url.rstrip('/') + '/vsts/info')
25+
request = ClientRequest(method='GET', url=url)
2726
headers = {'Accept': 'application/json'}
2827
if self._suppress_fedauth_redirect:
2928
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
@@ -34,9 +33,7 @@ def get_vsts_info(self, relative_remote_url):
3433

3534
@staticmethod
3635
def get_vsts_info_by_remote_url(remote_url, credentials, suppress_fedauth_redirect=True):
37-
request = ClientRequest()
38-
request.url = remote_url.rstrip('/') + '/vsts/info'
39-
request.method = 'GET'
36+
request = ClientRequest(method='GET', url=remote_url.rstrip('/') + '/vsts/info')
4037
headers = {'Accept': 'application/json'}
4138
if suppress_fedauth_redirect:
4239
headers['X-TFS-FedAuthRedirect'] = 'Suppress'

vsts/vsts/git/v4_1/git_client.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# --------------------------------------------------------------------------
77

88

9-
from msrest.pipeline import ClientRequest
9+
from msrest.universal_http import ClientRequest
1010
from .git_client_base import GitClientBase
1111

1212

@@ -20,13 +20,26 @@ def __init__(self, base_url=None, creds=None):
2020
super(GitClient, self).__init__(base_url, creds)
2121

2222
def get_vsts_info(self, relative_remote_url):
23-
request = ClientRequest()
24-
request.url = self._client.format_url(relative_remote_url.rstrip('/') + '/vsts/info')
25-
request.method = 'GET'
23+
url = self._client.format_url(relative_remote_url.rstrip('/') + '/vsts/info')
24+
request = ClientRequest(method='GET', url=url)
2625
headers = {'Accept': 'application/json'}
2726
if self._suppress_fedauth_redirect:
2827
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
2928
if self._force_msa_pass_through:
3029
headers['X-VSS-ForceMsaPassThrough'] = 'true'
3130
response = self._send_request(request, headers)
3231
return self._deserialize('VstsInfo', response)
32+
33+
@staticmethod
34+
def get_vsts_info_by_remote_url(remote_url, credentials,
35+
suppress_fedauth_redirect=True,
36+
force_msa_pass_through=True):
37+
request = ClientRequest(method='GET', url=remote_url.rstrip('/') + '/vsts/info')
38+
headers = {'Accept': 'application/json'}
39+
if suppress_fedauth_redirect:
40+
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
41+
if force_msa_pass_through:
42+
headers['X-VSS-ForceMsaPassThrough'] = 'true'
43+
git_client = GitClient(base_url=remote_url, creds=credentials)
44+
response = git_client._send_request(request, headers)
45+
return git_client._deserialize('VstsInfo', response)

vsts/vsts/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55

6-
VERSION = "0.1.19"
6+
VERSION = "0.1.20"

vsts/vsts/vss_client.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from msrest import Deserializer, Serializer
1414
from msrest.exceptions import DeserializationError, SerializationError
15-
from msrest.pipeline import ClientRequest
15+
from msrest.universal_http import ClientRequest
1616
from msrest.service_client import ServiceClient
1717
from .exceptions import VstsAuthenticationError, VstsClientRequestError, VstsServiceError
1818
from .vss_client_configuration import VssClientConfiguration
@@ -120,11 +120,9 @@ def _create_request_message(self, http_method, location_id, route_values=None,
120120
route_values)
121121
logger.debug('Route template: %s', location.route_template)
122122
url = self._client.format_url(route_template, **route_values)
123-
request = ClientRequest()
124-
request.url = self._client.format_url(url)
123+
request = ClientRequest(method=http_method, url=self._client.format_url(url))
125124
if query_parameters:
126125
request.format_parameters(query_parameters)
127-
request.method = http_method
128126
return request
129127

130128
@staticmethod
@@ -167,12 +165,10 @@ def _get_resource_locations(self, all_host_types):
167165

168166
# Last resort, make the call to the server
169167
options_uri = self._combine_url(self.config.base_url, '_apis')
170-
request = ClientRequest()
171-
request.url = self._client.format_url(options_uri)
168+
request = ClientRequest(method='OPTIONS', url=self._client.format_url(options_uri))
172169
if all_host_types:
173170
query_parameters = {'allHostTypes': True}
174171
request.format_parameters(query_parameters)
175-
request.method = 'OPTIONS'
176172
headers = {'Accept': 'application/json'}
177173
if self._suppress_fedauth_redirect:
178174
headers['X-TFS-FedAuthRedirect'] = 'Suppress'

0 commit comments

Comments
 (0)