@@ -14,9 +14,7 @@ def __init__(self):
1414 self .client_id = os .environ ["AZ_CLIENT_ID" ]
1515 self .client_secret = os .environ ["AZ_CLIENT_SECRET" ]
1616 self .client_tenant = os .environ ["AZ_CLIENT_TENANT" ]
17- self .access_token = self ._get_access_token
18- self .token = self .access_token
19- self .auth = requests .auth .HTTPBasicAuth ("" , self .token )
17+ self .access_token = self ._get_access_token ()
2018 self .notify_commit_sha = os .environ ["NOTIFY_COMMIT_SHA" ]
2119 self .utils_pr_number = os .environ ["UTILS_PR_NUMBER" ]
2220 self .notify_github_repo = "NHSDigital/api-management-utils"
@@ -39,14 +37,14 @@ def run_pipeline(self,
3937
4038 run_url = self .base_url + f"/{ pipeline_id } /runs"
4139 request_body = self ._build_request_body (pipeline_branch )
42- print ("A Request Body" , request_body )
4340
4441 response = self .api_request (
4542 run_url ,
4643 json = request_body ,
4744 method = 'post' ,
4845 )
4946 self .print_response (response , f"Initial request to { run_url } " )
47+ print ("Response Check In Pipeline Run" , response .status_code )
5048
5149 result = "failed"
5250 if response .status_code == 200 :
@@ -121,7 +119,7 @@ def api_request(
121119 ):
122120 def get_headers ():
123121
124- _headers = {"Accept" : "application/json" , "Authorization" : f"Bearer { self .token } " }
122+ _headers = {"Accept" : "application/json" , "Authorization" : f"Bearer { self .access_token } " }
125123 _headers .update (headers or {})
126124 return _headers
127125
@@ -138,8 +136,8 @@ def get_headers():
138136 break
139137
140138 if result .status_code in (203 , 401 ):
141- print ("REFRESHING ACCESS TOKEN..." , result . status_code )
142- self .token = self ._get_access_token ()
139+ print ("REFRESHING ACCESS TOKEN..." )
140+ self .access_token = self ._get_access_token ()
143141
144142 time .sleep (0.5 * tries )
145143 result = action (uri , params = _params , headers = get_headers (), ** kwargs )
0 commit comments