This tutorial is about writing a post with beem. You learned in my last post how to install beem. Let's use it now.
Storing the posting key inside the beem wallet
At first we need to store the posting key (safely encrypted in a sqlite wallet):
At first we need a wallet (This step is only necessary once):
beempy createwallet --wipe
Now we can check, if the wallet was sucessfully created:
beempy walletinfo
For publishing a post, we need to store the posting key:
beempy addkey
We can check if this has worked by:
beempy listaccounts
I will use beembot for testing, so I added the posting key of beembot:
As we do not wan't to write down our wallet password, we will temporarily store it as environment variable for windows:
set UNLOCK=yourpassword
and for linux:
export UNLOCK='yourpassword'
We can check if this had worked by:
beempy walletinfo --test-unlock
A similar table should be displayed now (after setting UNLOCK
inside the terminal) without entering a password:
Writing a python script with all information:
At first, I used ImageUploader
for uploading a png image to steemit:
img_link = image_uploader.upload(image_path, author, image_name="beem-logo.png")
image_path
contains an image filename, author
is a account (its posting key needs to be stored).
The function returns a dict, img_link["url"]
contains the url, which can be used inside the post for displaying the uploaded image.
Then I created all necessary variables and entered them into the post function of steem
:
- author: post author (steem account name)
- title: post title (the permlink is automatically created from this)
- parse_body: Is set to True, which will means that all image, url and mentions are correctly handled.
- self_vote: I disabled self-vote here.
- tags: list with tags, There is no limit and more than 5 tags can be set.
The following script was used to create an example post:
#!/usr/bin/python
from beem.imageuploader import ImageUploader
from beem import Steem
if __name__ == "__main__":
stm = Steem()
author = "beembot"
image_path = "beem-logo.png"
image_uploader = ImageUploader(steem_instance=stm)
img_link = image_uploader.upload(image_path, author, image_name="beem-logo.png")
title = "Example for writing a post with beem"
body = "This is an example for a post, created with beem by @beembot."\
"We will also upload an image:"\
"%s" % img_link["url"]
parse_body = True
self_vote = False
tags = ["python", "test", "this", "is", "just", "a", "post"]
stm.post(title, body, author=author, tags=tags, parse_body=parse_body, self_vote=self_vote)
Save your python script now as file (I choose write_post_with_image.py
) and run it with python:
python write_post_with_image.py
Remember to set the UNLOCK
variable at first. Otherwise you will get a beem.exceptions.WalletLocked
exception.
Hi @holger80! We are @steem-ua, a new Steem dApp, computing UserAuthority for all accounts on Steem. We are currently in test modus and want to thank you for delegating SP to us in this early stage!
This post has been just added as new item to timeline of beem on Steem Projects.
If you want to be notified about new updates from this project, register on Steem Projects and add beem to your favorite projects.
Great post and instructions
Posted using Partiko iOS
How can i edit a post with beem and add more tags?
Just use
stm.post()
again with the same title. The newbody
overwrites the post content.Add more strings to
tags
and more tags are included, e.g.:tags = ["a", "b", "c", "d", "e", "f", "g", "h"]
@holger80 can you please give me a contact so we can talk about this? Discord? Telegram? Facebook?
I can't understand and i need help..
Nice, beempy works like a charm!

Just claimed some rewards with it, smooth! Time to do my posts and downvotes from python!
You're a waste of space. You've been flagged like the trash you are.
I'm coming 4 ya!
You're a waste of space. You've been flagged like the trash you are.