Merge pull request #3 from slashtechno/deepsource-autofix-908ab65d

refactor unnecessary `else` / `elif` when `if` block has a `raise` statement
This commit is contained in:
/techno 2023-08-06 19:04:03 -04:00 committed by GitHub
commit 61990cfa4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 18 deletions

View File

@ -19,7 +19,6 @@ class Config:
def token(self, token):
if token is None:
raise ValueError("No token provided")
else:
url = "https://api.cloudflare.com/client/v4/user/tokens/verify"
headers = {
"Authorization": f"Bearer {token}",
@ -28,7 +27,6 @@ class Config:
response = requests.get(url, headers=headers, timeout=10)
if response.json()["success"] is False:
raise ValueError("Invalid token")
else:
# Token needs the following scopes:
# Zero Trust: Read/Edit
# Account Firewall Access Rules: Read/Edit
@ -43,7 +41,6 @@ class Config:
def account_id(self, account_id):
if account_id is None:
raise ValueError("No account ID provided")
else:
# Possibly make a request to lists to check if the account ID exists
self._account_id = account_id