OpenIxia / ixnetwork_restpy

The IxNetwork python client.
https://openixia.github.io/ixnetwork_restpy/#/
MIT License
30 stars 16 forks source link

UnboundLocalError: local variable 'response' referenced before assignment #56

Closed gerardduff closed 3 years ago

gerardduff commented 3 years ago

Version couldn't find a file version number, but it is ixnetwork-restpy 1.1.1

Problem ixnetwork_restpy/connection.py - line 475 references "response". However the response is only assigned in the first if statement on line 464 of the same file.

Solution check if response exists, if not try a session request, then return as originally planned.

Notes It's generally not good practice to have multiple returns, it might be worth investigating if its possible to have a response status code variable assigned, with a single return at the end

General Thanks of the effort and the code. Very much apprieciated.

gerardduff commented 3 years ago

The issue was realized when there was a state "ERROR" which is unhandled in the _poll method, which goes to the "else" clause where "response" is used before being defined. This should be fixed in the codebase. :)

ajbalogh commented 3 years ago

@gerardduff thanks for your feedback. We are looking at this issue right now.

gerardduff commented 3 years ago

Hi all. Any progress on the issue?:)

ajbalogh commented 3 years ago

addressed in v1.1.2