Instantly share code, notes, and snippets.

Embed
What would you like to do?
Publish to blogger
# Call easyblogger
# Client secret and authentication is already stored in ~/.easyblogger.credentials
# blogid is stored in ~/.easyblogger
import subprocess
import blogger_modifications
def publish(html_file, title, labels, post_id):
# print('publishing', html_file, 'with title', title, 'labels', labels, 'and post-id', post_id, flush=True)
# Modify html as needed.
blogger_modifications.modify(html_file)
# If post-id doesnt already exist,
if not post_id:
command = f'easyblogger.exe post -t "{title}" -l "{", ".join(labels)}" -f "{html_file}"'
else:
command = f'easyblogger.exe update -t "{title}" -l "{", ".join(labels)}" -f "{html_file}" {post_id}'
subprocess.run(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment