From 84818e6df1fcd85728be453c09aff2753e9d3fed Mon Sep 17 00:00:00 2001 From: Eric Brown Date: Thu, 31 Oct 2024 21:04:33 -0700 Subject: [PATCH] Use response.ok instead of specific code Simply replace explicit checking for status code of 201 for response.ok. Makes code a little simpler. Signed-off-by: Eric Brown --- precli/cli/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precli/cli/main.py b/precli/cli/main.py index a746db5..51a3934 100644 --- a/precli/cli/main.py +++ b/precli/cli/main.py @@ -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}")