Skip to content

Commit

Permalink
Use response.ok instead of specific code (#679)
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 authored Nov 1, 2024
1 parent e4a1048 commit f305ca3
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 f305ca3

Please sign in to comment.