Advertisement
wil1liam

steem-python-newest-post

Jan 30th, 2018
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. from steem import Steem
  2.  
  3. s = Steem(nodes=["https://api.steemit.com"])
  4.  
  5. def newest_post(username):
  6.     limit = 100
  7.     account_history = s.get_account_history(username,index_from=-1,limit=limit)
  8.     try:
  9.         for i in range(limit+1):
  10.             operation = account_history[limit-i]
  11.             if (operation[1]["op"][0] == "comment"):
  12.                 if (operation[1]["op"][1]["title"]!= ""):
  13.                     return operation[1]["op"][1]["permlink"]
  14.     except IndexError:
  15.         return None
  16.  
  17. print(newest_post("wil1liam"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement