Last active
July 6, 2020 05:20
-
-
Save mtreacy002/d8f9a9778792fe111ea2a70671de5f1b to your computer and use it in GitHub Desktop.
Python decorator - tuple to namedtuple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def http_response_checker(result): | |
if result[1] == HTTPStatus.NOT_FOUND: | |
result = http_not_found_status_checker(result) | |
# ... more 'if' here ... | |
return result | |
def http_not_found_status_checker(result): | |
if result[0] == messages.WRONG_USERNAME_OR_PASSWORD | |
return messages.WRONG_USERNAME_OR_PASSWORD, HTTPStatus.UNAUTHORIZED | |
# ... more 'if' here ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment