raannakasturi commited on
Commit
dcc513f
·
verified ·
1 Parent(s): 24b1a2e

Update post_blog.py

Browse files
Files changed (1) hide show
  1. post_blog.py +7 -5
post_blog.py CHANGED
@@ -97,7 +97,7 @@ def create_post(title, category, summary, mindmap, citation):
97
  return post_title, post_category, post_body, post_image
98
 
99
  def post_post(title, category, body, image):
100
- data = None
101
  try:
102
  data = requests.post(
103
  url='https://oauth2.googleapis.com/token',
@@ -125,14 +125,16 @@ def post_post(title, category, body, image):
125
  "content": body,
126
  "labels": [category, "ZZZZZZZZZ"]
127
  }
128
- data = requests.post(url, headers=headers, json=post_data).json()
129
- if data['status'] == 'LIVE':
130
- print(f"The post '{title}' is {data['status']}")
131
  return True
132
  else:
133
- print(f"Error posting {title}: {data}")
 
134
  return False
135
  except Exception as e:
 
136
  print(f"Error posting {title}: {e}")
137
  return False
138
 
 
97
  return post_title, post_category, post_body, post_image
98
 
99
  def post_post(title, category, body, image):
100
+ response = None
101
  try:
102
  data = requests.post(
103
  url='https://oauth2.googleapis.com/token',
 
125
  "content": body,
126
  "labels": [category, "ZZZZZZZZZ"]
127
  }
128
+ response = requests.post(url, headers=headers, json=post_data).json()
129
+ if response['status'] == 'LIVE':
130
+ print(f"The post '{title}' is {response['status']}")
131
  return True
132
  else:
133
+ print(response)
134
+ print(f"Error posting {title}: {response}")
135
  return False
136
  except Exception as e:
137
+ print(response)
138
  print(f"Error posting {title}: {e}")
139
  return False
140