Skip to content

Commit

Permalink
Fixed: Redefined variable [LGTM] (0.8.4_patch) (#444)
Browse files Browse the repository at this point in the history
It truly annoys me when static analysis refers to my programmatic statements as `useless`.
  • Loading branch information
jshcodes authored Nov 23, 2021
1 parent d9d2ca3 commit be4b10e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/falconpy/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,16 +407,14 @@ def confirm_base_url(provided_base: str = "https://api.crowdstrike.com"):
If it does not, it is looked up in the BaseURL enum. If the value is not found
within the enum, https:// is prepended to the value and then it is used for API requests.
"""
returned_base = "https://api.crowdstrike.com"
# Assume they passed a full URL
returned_base = provided_base
if "://" not in provided_base:
# They're passing the name instead of the URL
try:
returned_base = f"https://{BaseURL[provided_base.upper()].value}"
except KeyError:
# Invalid base URL name, assume they didn't give us https
# Invalid base URL name, fall back to assuming they didn't give us https
returned_base = f"https://{provided_base}"
else:
# They passed a full URL
returned_base = provided_base

return returned_base

0 comments on commit be4b10e

Please sign in to comment.