Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pylama rightly complaints against two expressions in asa.py #36

Open
mcepl opened this issue Jan 5, 2023 · 0 comments
Open

pylama rightly complaints against two expressions in asa.py #36

mcepl opened this issue Jan 5, 2023 · 0 comments

Comments

@mcepl
Copy link

mcepl commented Jan 5, 2023

To avoid those this patch needs to be applied:

---
 napalm_asa/asa.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/napalm_asa/asa.py
+++ b/napalm_asa/asa.py
@@ -62,7 +62,7 @@ class RespFetcherHttps:
         try:
             token_request = self.session.post(full_url, auth=(self.username, self.password),
                                               data="", timeout=self.timeout, verify=False)
-            if token_request.status_code is 204 and 'X-Auth-Token' in token_request.headers.keys():
+            if token_request.status_code == 204 and 'X-Auth-Token' in token_request.headers.keys():
                 self.token = token_request.headers['X-Auth-Token']
                 self.session.headers.update({'X-Auth-Token': token_request.headers['X-Auth-Token']})
                 return (True, None)
@@ -78,7 +78,7 @@ class RespFetcherHttps:
             token_delete_request = self.session.delete(full_url,
                                                        auth=(self.username, self.password),
                                                        timeout=self.timeout, verify=False)
-            if token_delete_request.status_code is 204:
+            if token_delete_request.status_code == 204:
                 self.session.headers.pop('X-Auth-Token', None)
                 return (True, None)
             else:
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Jan 8, 2023
…056866

https://build.opensuse.org/request/show/1056866
by user mcepl + dimstar_suse
- Update to version 20180525.8c54a85:
  * Version bump
  * Implement token auth (#17)
  * Add built status and pypi version to README
  * PY3 compatibility for tests
  * Fix style and add optinal_args protection against falsy value
  * Add .travis.yaml
  * Support for rest-api agents that run on non-standard tcp port. (#14)
  * Clean up after replacing url2libe with requests
  * Removing pylama.ini
  * Replace urllib2 with requests
- Add napalm-py23_compat.patch to fix missing py23_compat.py file
  (gh#napalm-automation-community/napalm-asa#35).
- Add pylama.patch to fix two problems discovered by pylama
  (gh#napalm-automation-community/napalm-asa#36).
- Switch to git checkout version (releases are significantly
  lagging).
- Update to version 20211220.27ac4ce:
  * get_interfaces added
  *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant