Skip to content

Instantly share code, notes, and snippets.

@durgaswaroop
Created December 31, 2017 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save durgaswaroop/20bef02450137907d01f794ba99b965c to your computer and use it in GitHub Desktop.
Save durgaswaroop/20bef02450137907d01f794ba99b965c to your computer and use it in GitHub Desktop.
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