Random Bot Post by @coininstant!!

in #python5 years ago (edited)

Random Picture Included! This post created with beem by @coininstant. Here is a random image uploaded with beempy image:x

Here is the source code that generated this post.


#!/usr/local/bin/python3
from beem.imageuploader import ImageUploader
from beem import Steem
import random, os

if name == "main":
stm = Steem()
author = "coininstant"
path = "/Users/nick/randompics"
random_filename = random.choice([
x for x in os.listdir(path)
if os.path.isfile(os.path.join(path, x))
])
image_path = random_filename
image_uploader = ImageUploader(steem_instance=stm)
img_link = image_uploader.upload(image_path, author, image_name="@coininstant)")

title = "Random Bot Post by @coininstant!!"

body = "Random Picture Included! This post created with beem by @coininstant. "\
       "Here is a random image uploaded with beempy image:![x]("\
       "%s" % img_link["url"]
parse_body = True
self_vote = False
tags = ["python", "random", "this", "beem", "just", "a", "post"]
stm.post(title, body, author=author, tags=tags, parse_body=parse_body, self_vote=self_vote)

Follow @coininstant for more!

Sort:  

Random pictures are so beautiful bro @coininstant

Posted using Partiko Android

Hello coininstant!

Congratulations! This post has been randomly Resteemed! For a chance to get more of your content resteemed join the Steem Engine Team