Unfollow Everything!

in #steem-python8 years ago

I did an early spring cleaning yesterday.
Unfollowing all 3000 followees..followingers..fellowship..users I do follow.
And I had to do it by force. I did write a nice script, but that didn't work.
Instead, brute force:

from steem import Steem
from steem.commit import Commit
from steem.account import Account

username='isnochys'
s = Steem()
c = Commit(s)
aac = Account(username,s)
exp = aac.export()
fl = exp['following']
for fol in fl:
    c.unfollow(unfollow=fol, account=username)

That is a really awfull script.
But it worked.

I had something else in my mind, when I first got spring cleaning in my head:

from steem import Steem
from steem.commit import Commit
from steem.account import Account
from steem.transactionbuilder import TransactionBuilder
from steembase import operations

username='isnochys'
s = Steem()
c = Commit(s)
aac = Account(username,s)
exp = aac.export()
fl = exp['following']
unfol=[]
for fol in fl:
    required_auths=[]
    required_posting_auths =[username]
    id = 'follow'
    json = ["follow",{"follower":username,"following":fol,"what":[]}]
    mdi = {"required_auths": required_auths,'required_posting_auths':required_posting_auths,'id':id,'json':json}
    unfol.append(mdi)

tb = TransactionBuilder()
operation = [operations.CustomJson(**x) for x in unfol]
tb.appendOps(operation)
tb.appendSigner(username, 'posting')
tb.sign()
tx = tb.broadcast()

This would have been way more elegant.
But I tried and failed with:

InsufficientAuthorityError

I have no idea, why it didn't work.
I looked into steemd.py and other linked files. The unfollow command does exactly the same, as I did in the transaction builder.
Well, I got my unfollowing. It just took a bit longer.

Sort:  

InsufficientAuthorityError

That seems to give the idea that you didn't adress the right authorization keys.

Are you sure you gave the 'posting key' with it?

To quote steemd.py for def sign:

param string wifs: One or many wif keys to use for signing
                a transaction. If not present, the keys will be loaded
                from the wallet as defined in "missing_signatures" key
                of the transactions.

it is signed successfully, it gets the key from my wallet. It worked with no_broadcast=True.
And the error occurs in tb.broadcast()
Also, previous tests with different operations(but with active key, to be true) worked with no_broadcast=False
Anyway, what's done is done;)

This post has been upvoted by @microbot with 18.1%!
Vote for my creator @isnochys as witness!

Steemit Auto Those who work "Steemit" should only increase 1000 Follower. Auto Just once "10k follower"
Steemit Account login,
Login...100% Real free

http://autosteemit.wapka.mobi

যারা Steemit কাজ করেন শুধুমাএ তাদের জন্য Auto 1000 Follower বাড়িয়ে নিন। শুধু একবার 10k ফলোয়ার।
Steemit Account login,
লগইন করুন...100% Real free

Yay!
My first spam in a long time!
OOhh..!! Thank you!

Lolololol

Coin Marketplace

STEEM 0.10
TRX 0.31
JST 0.032
BTC 112108.10
ETH 4009.68
USDT 1.00
SBD 0.64