@@ -35,6 +35,7 @@ def __init__(self, base_url=None, creds=None, user_agent=None):
35
35
self .clients = ClientFactory (self )
36
36
self .clients_v5_0 = ClientFactoryV5_0 (self )
37
37
self .clients_v5_1 = ClientFactoryV5_1 (self )
38
+ self .use_fiddler = False
38
39
39
40
def get_client (self , client_type ):
40
41
"""get_client.
@@ -57,6 +58,8 @@ def _get_client_instance(self, client_class):
57
58
url = self ._get_url_for_client_instance (client_class )
58
59
client = client_class (url , self ._creds )
59
60
client .add_user_agent (self ._addition_user_agent )
61
+ if self .use_fiddler :
62
+ self ._configure_client_for_fiddler (client )
60
63
return client
61
64
62
65
def _get_url_for_client_instance (self , client_class ):
@@ -89,6 +92,8 @@ def _get_deployment_resource_area_from_sps(self, resource_id):
89
92
if resource_id in _deployment_level_resource_areas :
90
93
return _deployment_level_resource_areas [resource_id ]
91
94
location_client = LocationClient (sps_url , self ._creds )
95
+ if self .use_fiddler :
96
+ self ._configure_client_for_fiddler (location_client )
92
97
resource_area = location_client .get_resource_area (area_id = resource_id )
93
98
_deployment_level_resource_areas [resource_id ] = resource_area
94
99
return resource_area
@@ -99,6 +104,8 @@ def authenticate(self):
99
104
def _get_resource_areas (self , force = False ):
100
105
if self ._resource_areas is None or force :
101
106
location_client = LocationClient (self .base_url , self ._creds )
107
+ if self .use_fiddler :
108
+ self ._configure_client_for_fiddler (location_client )
102
109
if not force and RESOURCE_FILE_CACHE [location_client .normalized_url ]:
103
110
try :
104
111
logger .debug ('File cache hit for resources on: %s' , location_client .normalized_url )
@@ -125,6 +132,11 @@ def _get_resource_areas(self, force=False):
125
132
def _combine_url (part1 , part2 ):
126
133
return part1 .rstrip ('/' ) + '/' + part2 .strip ('/' )
127
134
135
+ @staticmethod
136
+ def _configure_client_for_fiddler (client ):
137
+ client .config .connection .verify = False
138
+ client .config .proxies .add (protocol = 'https' , proxy_url = 'https://127.0.0.1:8888' )
139
+
128
140
129
141
_deployment_level_resource_areas = {}
130
142
sps_url = 'https://app.vssps.visualstudio.com'
0 commit comments