Spaces:
Running
Running
Commit
·
db9b48e
1
Parent(s):
bfb44d5
Refactor post_blog function to improve error handling and control flow
Browse files- post_blog.py +1 -4
post_blog.py
CHANGED
@@ -124,7 +124,7 @@ def post_post(title, category, body, image):
|
|
124 |
def post_blog(title, category, summary, mindmap, citation, uaccess_key):
|
125 |
if uaccess_key != access_key:
|
126 |
return False
|
127 |
-
|
128 |
post_title, post_category, post_body, post_image = create_post(title, category, summary, mindmap, citation)
|
129 |
status = post_post(post_title, post_category, post_body, post_image)
|
130 |
print(f"Waiting for {3*60} seconds...")
|
@@ -135,9 +135,6 @@ def post_blog(title, category, summary, mindmap, citation, uaccess_key):
|
|
135 |
else:
|
136 |
print('Failed to create post')
|
137 |
return False
|
138 |
-
except Exception as e:
|
139 |
-
print('An error occurred:', str(e))
|
140 |
-
return False
|
141 |
|
142 |
def test(access_key):
|
143 |
data = {
|
|
|
124 |
def post_blog(title, category, summary, mindmap, citation, uaccess_key):
|
125 |
if uaccess_key != access_key:
|
126 |
return False
|
127 |
+
else:
|
128 |
post_title, post_category, post_body, post_image = create_post(title, category, summary, mindmap, citation)
|
129 |
status = post_post(post_title, post_category, post_body, post_image)
|
130 |
print(f"Waiting for {3*60} seconds...")
|
|
|
135 |
else:
|
136 |
print('Failed to create post')
|
137 |
return False
|
|
|
|
|
|
|
138 |
|
139 |
def test(access_key):
|
140 |
data = {
|