Skip to content

Commit

Permalink
Use response.ok instead of specific code
Browse files Browse the repository at this point in the history
Simply replace explicit checking for status code of 201 for
response.ok. Makes code a little simpler.

Signed-off-by: Eric Brown <eric.brown@securesauce.dev>
  • Loading branch information
ericwb committed Nov 1, 2024
1 parent e4a1048 commit 84818e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion precli/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def create_gist(file, renderer: Renderer):
}
response = requests.post(url, json=data, headers=headers, timeout=5)

if response.status_code == 201:
if response.ok:
print(f"Gist created successfully: {response.json()['html_url']}")
else:
print(f"Failed to create gist: {response.status_code}")
Expand Down

0 comments on commit 84818e6

Please sign in to comment.