@@ -58,17 +58,28 @@ post = Post(
5858
5959post.add({' type' : ' paragraph' , ' content' : ' This is how you add a new paragraph to your post!' })
6060
61- # bolden text
62- post.add({' type' : " paragraph" ,' content' :[{' content' : " This is how you " },{' content' : " bolden " ,' marks' :[{' type' : " strong" }]},{' content' : " a word." }]})
61+ # bolden text
62+ post.add({' type' : " paragraph" ,
63+ ' content' : [{' content' : " This is how you " }, {' content' : " bolden " , ' marks' : [{' type' : " strong" }]},
64+ {' content' : " a word." }]})
6365
64- # add hyperlink to text
65- post.add({' type' :' paragraph' ,' content' :[{' content' : " View Link" ,' marks' :[{' type' : " link" ,' href' :' https://whoraised.substack.com/' }]}]})
66+ # add hyperlink to text
67+ post.add({' type' : ' paragraph' , ' content' : [
68+ {' content' : " View Link" , ' marks' : [{' type' : " link" , ' href' : ' https://whoraised.substack.com/' }]}]})
6669
67- # add image
68- post.add({' type' :' captionedImage' ,' src' : " https://media.tenor.com/7B4jMa-a7bsAAAAC/i-am-batman.gif" })
70+ # add image
71+ post.add({' type' : ' captionedImage' , ' src' : " https://media.tenor.com/7B4jMa-a7bsAAAAC/i-am-batman.gif" })
72+
73+ # add local image
74+ image = api.get_image(' image.png' )
75+ post.add({" type" : " captionedImage" , " src" : image.get(" url" )})
6976
7077draft = api.post_draft(post.get_draft())
7178
79+ # set section (THIS CAN BE DONE ONLY AFTER HAVING FIRST POSTED THE DRAFT)
80+ post.set_section(" rick rolling" , api.get_sections())
81+ api.put_draft(draft.get(" id" ), draft_section_id = post.draft_section_id)
82+
7283api.prepublish_draft(draft.get(" id" ))
7384
7485api.publish_draft(draft.get(" id" ))
0 commit comments