From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7A01E42D60 for ; Mon, 26 Jun 2023 23:38:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7586640223; Mon, 26 Jun 2023 23:38:51 +0200 (CEST) Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by mails.dpdk.org (Postfix) with ESMTP id EE5944013F for ; Mon, 26 Jun 2023 23:38:49 +0200 (CEST) Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-553a1f13d9fso3210234a12.1 for ; Mon, 26 Jun 2023 14:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1687815529; x=1690407529; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zSvqbEQrpn5YccSFftcpbL92PVEbROcFo7rB/Ol3C94=; b=MoBULzrm9451i3yEhF9xbjA/i9neXmcFI26mH32f0brz1JP4LvGCCAstuPyFJNKORm NboEea8At7HRfiMp354b+4VJWkUyukmCVOqdiiGZjge2lGRDrTSKdfqRjO7lzoU0+ZSg jIaXYsFOglh7VF+LQK3IgGcOi+x3/6T2iNUj8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687815529; x=1690407529; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zSvqbEQrpn5YccSFftcpbL92PVEbROcFo7rB/Ol3C94=; b=ayVF2/CmIRYJ6dR/09MUtlvCCmAtceyQP74QS8WX44sIx+oryMhFpbLxT0wjoSi6V+ 2CTrB9TEAi0un+kIG+4YG/92V52jUZfTYZsEo/ih6T2GzsCTHXNrj1FDiKrvQPZPtkN0 s0gzI0VkNx0eDDka8EgvXWJPI9bha+hPdK7DOOHHw+JJuOm3cGGQnBB6KpR8liPB5NJY Oqbi+wLcoSOek3wUx4GriPpuss8x+0A62U7Xxbw3WENhKegq0tVvakKXzlBZOmwxn7RI rIIxgsGmBo+INij3hfy+QZbwTX/j9koSKCqIQLKXmA8TX9Y2xT7INMCWzYAVFpimAP7K zEwA== X-Gm-Message-State: AC+VfDxaqZvdh5BuX4oyzZMYmz0thDOclFcWQ1RLURlf4W6Cv3O/fSp6 gb7Z4znT0jgock1gvMZmwI4IgeIbl3snHVCi8Mbhr2DqbPtehMKW X-Google-Smtp-Source: ACHHUZ6Z91oA4F2G/tfgOuYqtClNh3QJ0wmQjHxDv0bGjM7cabQulN6m+CWPP5A3Qm/qkBwgGPOg/oNkjljl5Z88Eao= X-Received: by 2002:a17:90b:1bc8:b0:262:e821:b3f8 with SMTP id oa8-20020a17090b1bc800b00262e821b3f8mr5244857pjb.38.1687815529129; Mon, 26 Jun 2023 14:38:49 -0700 (PDT) MIME-Version: 1.0 References: <20230621195342.5035-2-jspewock@iol.unh.edu> In-Reply-To: From: Jeremy Spewock Date: Mon, 26 Jun 2023 17:38:38 -0400 Message-ID: Subject: Re: [PATCH v1] tools: add jwt renewal function to acvp_tool To: Aaron Conole Cc: ci@dpdk.org Content-Type: multipart/alternative; boundary="0000000000000f861b05ff0f2d0a" X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ci-bounces@dpdk.org --0000000000000f861b05ff0f2d0a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Fixed in v2, thanks for the feedback! -Jeremy On Mon, Jun 26, 2023 at 3:00=E2=80=AFPM Aaron Conole w= rote: > Jeremy Spewock writes: > > > On Fri, Jun 23, 2023 at 10:15=E2=80=AFAM Aaron Conole > wrote: > > > > jspewock@iol.unh.edu writes: > > > > > From: Jeremy Spewock > > > > > > Adds a method that follows the process for renewing your jwt accordi= ng > > > to NIST API documentation. This way, if there are load issues and it > > > takes too long to get vectors back with multi-algorithm testing, you > can > > > still get restuls and the script will not error. > > > > > > Also, added a maximum number of renewals so that the script cannot r= un > > > infinitely. > > > > > > Signed-off-by: Jeremy Spewock > > > --- > > > > Just some nits - I haven't run this through black / flake8. > > > > > tools/acvp/acvp_tool.py | 73 > +++++++++++++++++++++++++++++++++++------ > > > 1 file changed, 63 insertions(+), 10 deletions(-) > > > > > > diff --git a/tools/acvp/acvp_tool.py b/tools/acvp/acvp_tool.py > > > index 40d2f2f..8d50a58 100755 > > > --- a/tools/acvp/acvp_tool.py > > > +++ b/tools/acvp/acvp_tool.py > > > @@ -1,7 +1,7 @@ > > > #!/usr/bin/env python3 > > > > > > # SPDX-License-Identifier: BSD-3-Clause > > > -# Copyright 2022 The University of New Hampshire > > > +# Copyright 2023 The University of New Hampshire > > > > > > import hashlib > > > import sys > > > @@ -36,6 +36,8 @@ class ACVPProxy: > > > self.totp_path: str =3D totp_path > > > self.login_data: Optional[Dict[str, Any]] =3D None > > > self.session_data: Optional[Dict[str, Any]] =3D None > > > + self.retries: int =3D 0 > > > + self.max_retries: int =3D 2 > > > > > > with open(config_path, 'r') as f: > > > self.config: Any =3D json.load(f) > > > @@ -70,7 +72,13 @@ class ACVPProxy: > > > cert=3Dself.cert, > > > headers=3D{'Authorization': f'Bearer {token}'} > > > ) > > > - if not response.ok: > > > + if response.status_code =3D=3D 401: > > > + if self.__renew_jwt(): > > > + token =3D self.session_data['jwt'] > > > + continue > > > + logging.error("Failed to renew expired jwt") > > > + return None > > > + elif not response.ok: > > > logging.error(f'Failed to fetch vector set {url}') > > > logging.error(json.dumps(response.json(), indent=3D= 4)) > > > return None > > > @@ -85,6 +93,35 @@ class ACVPProxy: > > > logging.info(f'Downloaded vector set {url}') > > > return vector_set_json > > > > > > + def __renew_jwt(self) -> bool: > > > + """Renews the jwt in session_data. > > > + > > > + JWTs provided by the NIST API last 30 minutes which can > cause this > > > + script to fail even with good data. This method renews the > jwt using > > > + the login endpoint. > > > + > > > + @return: True if successfully renewed token > > > + """ > > > + if self.retries >=3D self.max_retries: > > > + logging.error("Maximum number of jwt renewals has been > reached.") > > > + return False > > > + response =3D requests.post( > > > + url=3Df'{self.config["url"]}/acvp/v1/login', > > > + json=3D[ > > > + {'acvVersion': '1.0'}, > > > + { > > > + 'password': self.__get_totp(), > > > + 'accessToken': self.session_data["jwt"] > > > + } > > > + ], > > > + cert=3Dself.cert, > > > + ) > > > + if response.ok: > > > + self.retries +=3D 1 > > > + self.session_data["jwt"] =3D > response.json()[1].pop("accessToken") > > > + return True > > > + return False > > > + > > > def login(self) -> bool: > > > """Log into the API server. > > > > > > @@ -141,7 +178,6 @@ class ACVPProxy: > > > cert=3Dself.cert, > > > headers=3D{'Authorization': f'Bearer > {self.login_data["jwt"]}'} > > > ) > > > - > > > > Why this line changed? > > > > I guess this line just ended up getting removed when I was making edits= . > I didn't do it for any deliberate > > reason other than spacing when I was making edits. > > > > > > > if not response.ok: > > > logging.error('Unable to register.') > > > logging.error(json.dumps(response.json(), indent=3D4)) > > > @@ -178,6 +214,12 @@ class ACVPProxy: > > > 'Authorization': f'Bearer > {self.session_data["jwt"]}' > > > } > > > ) > > > + if result.status_code =3D=3D 401: > > > + if self.__renew_jwt(): > > > + write_data[0]["jwt"] =3D > self.session_data["jwt"] > > > + continue > > > + logging.error("Failed to renew jwt") > > > + return None > > > version, result_json =3D result.json() > > > if 'retry' in result_json: > > > duration =3D result_json['retry'] > > > @@ -207,8 +249,19 @@ class ACVPProxy: > > > cert=3Dself.cert, > > > headers=3D{'Authorization': f'Bearer > {self.session_data["jwt"]}'} > > > ) > > > - > > > - if not response.ok: > > > > You also dropped a line spacing here as well. > > > > I think this is the same thing as above, when I was testing and writing > things in a couple of places this line > > also disappeared just because I felt it wasn't needed, but there wasn't > any particular reason. > > > > > > > + if response.status_code =3D=3D 401: > > > + if self.__renew_jwt(): > > > + response =3D requests.post( > > > + > f'{self.config["url"]}{session_url}/vectorSets/' > > > + f'{vector_set["vsId"]}/results', > > > + json=3D[version, vector_set], > > > + cert=3Dself.cert, > > > + headers=3D{'Authorization': f'Bearer > {self.session_data["jwt"]}'} > > > + ) > > > + else: > > > + logging.error("Failed to renew jwt") > > > + return False > > > + elif not response.ok: > > > has_error =3D True > > > logging.error(f'Could not upload vector set respons= e > for ' > > > f'vector set ID {vector_set["vsId"]}.= ') > > > @@ -239,13 +292,13 @@ def main(request_path: Optional[str], > > > config_path=3Dconfig_path, > > > ) > > > > > > - logging.info('Attempting to log in...') > > > - if not proxy.login(): > > > - logging.error('Could not log in.') > > > - sys.exit(1) > > > - logging.info('Successfully logged in.') > > > > > > if request_path: > > > + logging.info('Attempting to log in...') > > > + if not proxy.login(): > > > + logging.error('Could not log in.') > > > + sys.exit(1) > > > + logging.info('Successfully logged in.') > > > logging.info('Creating a new test session and downloading > vectors...') > > > test_session =3D proxy.register() > > > if not test_session: > > > > Would it be preferred that I add these lines back so that they closer > align with the original script? > > Please do, yes. Try to keep whitespace changes to a minimum. It gets > to be difficult sometimes to review. > > > Thanks, > > Jeremy > > --0000000000000f861b05ff0f2d0a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Fixed in v2, thanks for the feedback!

-Jeremy
On Mon, J= un 26, 2023 at 3:00=E2=80=AFPM Aaron Conole <aconole@redhat.com> wrote:
Jeremy Spewock <jspewock@iol.unh.edu> writes:

> On Fri, Jun 23, 2023 at 10:15=E2=80=AFAM Aaron Conole <aconole@redhat.com> wrot= e:
>
>=C2=A0 jspewo= ck@iol.unh.edu writes:
>
>=C2=A0 > From: Jeremy Spewock <jspewock@iol.unh.edu>
>=C2=A0 >
>=C2=A0 > Adds a method that follows the process for renewing your jw= t according
>=C2=A0 > to NIST API documentation. This way, if there are load issu= es and it
>=C2=A0 > takes too long to get vectors back with multi-algorithm tes= ting, you can
>=C2=A0 > still get restuls and the script will not error.
>=C2=A0 >
>=C2=A0 > Also, added a maximum number of renewals so that the script= cannot run
>=C2=A0 > infinitely.
>=C2=A0 >
>=C2=A0 > Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
>=C2=A0 > ---
>
>=C2=A0 Just some nits - I haven't run this through black / flake8.<= br> >
>=C2=A0 >=C2=A0 tools/acvp/acvp_tool.py | 73 ++++++++++++++++++++++++= +++++++++++------
>=C2=A0 >=C2=A0 1 file changed, 63 insertions(+), 10 deletions(-)
>=C2=A0 >
>=C2=A0 > diff --git a/tools/acvp/acvp_tool.py b/tools/acvp/acvp_tool= .py
>=C2=A0 > index 40d2f2f..8d50a58 100755
>=C2=A0 > --- a/tools/acvp/acvp_tool.py
>=C2=A0 > +++ b/tools/acvp/acvp_tool.py
>=C2=A0 > @@ -1,7 +1,7 @@
>=C2=A0 >=C2=A0 #!/usr/bin/env python3
>=C2=A0 >=C2=A0
>=C2=A0 >=C2=A0 # SPDX-License-Identifier: BSD-3-Clause
>=C2=A0 > -# Copyright 2022 The University of New Hampshire
>=C2=A0 > +# Copyright 2023 The University of New Hampshire
>=C2=A0 >=C2=A0
>=C2=A0 >=C2=A0 import hashlib
>=C2=A0 >=C2=A0 import sys
>=C2=A0 > @@ -36,6 +36,8 @@ class ACVPProxy:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.totp_path: str =3D t= otp_path
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.login_data: Optional= [Dict[str, Any]] =3D None
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.session_data: Option= al[Dict[str, Any]] =3D None
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.retries: int =3D 0
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.max_retries: int =3D 2 >=C2=A0 >=C2=A0
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 with open(config_path, &#= 39;r') as f:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.config= : Any =3D json.load(f)
>=C2=A0 > @@ -70,7 +72,13 @@ class ACVPProxy:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 cert=3Dself.cert,
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 headers=3D{'Authorization': f'Bearer {token}'}
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
>=C2=A0 > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if not response.= ok:
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if response.stat= us_code =3D=3D 401:
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if= self.__renew_jwt():
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 token =3D self.session_data['jwt']
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 continue
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 lo= gging.error("Failed to renew expired jwt")
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 re= turn None
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 elif not respons= e.ok:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 logging.error(f'Failed to fetch vector set {url}')
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 logging.error(json.dumps(response.json(), indent=3D4))
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 return None
>=C2=A0 > @@ -85,6 +93,35 @@ class ACVPProxy:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 logging.info(= f'Downloaded vector set {url}')
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return vect= or_set_json
>=C2=A0 >=C2=A0
>=C2=A0 > +=C2=A0 =C2=A0 def __renew_jwt(self) -> bool:
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Renews the j= wt in session_data.
>=C2=A0 > +
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 JWTs provided by the NIST API = last 30 minutes which can cause this
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 script to fail even with good = data. This method renews the jwt using
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 the login endpoint.
>=C2=A0 > +
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 @return: True if successfully = renewed token
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if self.retries >=3D self.m= ax_retries:
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 logging.error(&q= uot;Maximum number of jwt renewals has been reached.")
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return False
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 response =3D requests.post(
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 url=3Df'{sel= f.config["url"]}/acvp/v1/login',
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 json=3D[
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {&= #39;acvVersion': '1.0'},
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {<= br> >=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &#= 39;password': self.__get_totp(),
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &#= 39;accessToken': self.session_data["jwt"]
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<= br> >=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ],
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cert=3Dself.cert= ,
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 )
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if response.ok:
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.retries += =3D 1
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.session_dat= a["jwt"] =3D response.json()[1].pop("accessToken")
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return True
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return False
>=C2=A0 > +
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 def login(self) -> bool:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 """Log int= o the API server.
>=C2=A0 >=C2=A0
>=C2=A0 > @@ -141,7 +178,6 @@ class ACVPProxy:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cert=3Dself= .cert,
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 headers=3D{= 'Authorization': f'Bearer {self.login_data["jwt"]}= 9;}
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
>=C2=A0 > -
>
>=C2=A0 Why this line changed?
>
> I guess this line just ended up getting removed when I was making edit= s. I didn't do it for any deliberate
> reason other than spacing when I was making edits.
>=C2=A0
>=C2=A0
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if not response.ok:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 logging.err= or('Unable to register.')
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 logging.err= or(json.dumps(response.json(), indent=3D4))
>=C2=A0 > @@ -178,6 +214,12 @@ class ACVPProxy:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 'Authorization': f'Bearer {self= .session_data["jwt"]}'
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 }
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 )
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if= result.status_code =3D=3D 401:
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 if self.__renew_jwt():
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 write_data[0]["jwt"] =3D self.session= _data["jwt"]
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 continue
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 logging.error("Failed to renew jwt")
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 return None
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 version, result_json =3D result.json()
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 if 'retry' in result_json:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 duration =3D result_json['retry']
>=C2=A0 > @@ -207,8 +249,19 @@ class ACVPProxy:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 cert=3Dself.cert,
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 headers=3D{'Authorization': f'Bearer {self.session_data[&qu= ot;jwt"]}'}
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 )
>=C2=A0 > -
>=C2=A0 > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if not response.= ok:
>
>=C2=A0 You also dropped a line spacing here as well.
>
> I think this is the same thing as above, when I was testing and writin= g things in a couple of places this line
> also disappeared just because I felt it wasn't needed, but there w= asn't any particular reason.
>=C2=A0
>=C2=A0
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if response.stat= us_code =3D=3D 401:
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if= self.__renew_jwt():
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 response =3D requests.post(
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 f'{self.config["url"]}{session_ur= l}/vectorSets/'
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 f'{vector_set["vsId"]}/results= 9;,
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 json=3D[version, vector_set],
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 cert=3Dself.cert,
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 headers=3D{'Authorization': f'Beare= r {self.session_data["jwt"]}'}
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 )
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 el= se:
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 logging.error("Failed to renew jwt")
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 return False
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 elif not respons= e.ok:
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 has_error =3D True
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 logging.error(f'Could not upload vector set response for '
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 f'vector set ID {v= ector_set["vsId"]}.')
>=C2=A0 > @@ -239,13 +292,13 @@ def main(request_path: Optional[str],=
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 config_path=3Dconfig_path= ,
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 )
>=C2=A0 >=C2=A0
>=C2=A0 > -=C2=A0 =C2=A0 logging.info('Attempting to log in...'= )
>=C2=A0 > -=C2=A0 =C2=A0 if not proxy.login():
>=C2=A0 > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 logging.error('Could not l= og in.')
>=C2=A0 > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 sys.exit(1)
>=C2=A0 > -=C2=A0 =C2=A0 logging.info('Successfully logged in.'= )
>=C2=A0 >=C2=A0
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 if request_path:
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 logging.info('Attempting to = log in...')
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if not proxy.login():
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 logging.error(&#= 39;Could not log in.')
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sys.exit(1)
>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 logging.info('Successfully l= ogged in.')
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 logging.info('Creating = a new test session and downloading vectors...')
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 test_session =3D proxy.re= gister()
>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if not test_session:
>
> Would it be preferred that I add these lines back so that they closer = align with the original script?

Please do, yes.=C2=A0 Try to keep whitespace changes to a minimum.=C2=A0 It= gets
to be difficult sometimes to review.

> Thanks,
> Jeremy

--0000000000000f861b05ff0f2d0a--