Skip to content

Instantly share code, notes, and snippets.

@fmarani
Created August 29, 2019 11:50
Show Gist options
  • Save fmarani/9e54c55db2413d2cdc931cd4e05b9c73 to your computer and use it in GitHub Desktop.
Save fmarani/9e54c55db2413d2cdc931cd4e05b9c73 to your computer and use it in GitHub Desktop.
def generate_tag_string(post_id, tags=[], new=False):
"""
...
"""
if new:
tags.append('new')
post = get_post(post_id)
post_tags = [t.decode("utf8", "ignore") for t in post.get('tags', [])]
additional_tags = [t.decode("utf8", "ignore") for t in tags]
final_tags = set(post_tags + additional_tags) - set([''])
return '{}: {}'.format(post.get('author'), ', '.join(final_tags))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment