beem.community¶
-
class
beem.community.Communities(sort='rank', observer=None, last=None, limit=100, lazy=False, full=True, blockchain_instance=None, **kwargs)¶ Bases:
beem.community.CommunityObjectObtain a list of communities
Parameters: - name_list (list) – list of accounts to fetch
- batch_limit (int) – (optional) maximum number of accounts to fetch per call, defaults to 100
- blockchain_instance (Steem/Hive) – Steem() or Hive() instance to use when accessing a RPCcreator = Account(creator, blockchain_instance=self)
-
search_title(title)¶ Returns all communites which have a title similar to title
-
class
beem.community.Community(community, observer='', full=True, lazy=False, blockchain_instance=None, **kwargs)¶ Bases:
beem.blockchainobject.BlockchainObjectThis class allows to easily access Community data
Parameters: Returns: Account data
Return type: dictionary
Raises: beem.exceptions.AccountDoesNotExistsException – if account does not exist
Instances of this class are dictionaries that come with additional methods (see below) that allow dealing with an community and its corresponding functions.
>>> from beem.community import Community >>> from beem import Hive >>> from beem.nodelist import NodeList >>> nodelist = NodeList() >>> nodelist.update_nodes() >>> stm = Hive(node=nodelist.get_hive_nodes()) >>> community = Community("hive-139531", blockchain_instance=stm) >>> print(community) <Community hive-139531> >>> print(community.balances)
Note
This class comes with its own caching function to reduce the load on the API server. Instances of this class can be refreshed with
Community.refresh(). The cache can be cleared withCommunity.clear_cache()-
flag_post(account, permlink, notes, reporter)¶ Suggest a post for the review queue
Parameters: - account (str) – post author
- permlink (str) – permlink
- notes (str) – notes
- reporter (str) – Account who broadcast this
-
get_activities(limit=100, last_id=None)¶ Returns community activity
-
get_community_roles()¶ Lists community roles
-
get_ranked_posts(observer=None, limit=100, start_author=None, start_permlink=None, sort='created')¶ Returns community post
-
get_subscribers()¶ Returns subscribers
-
json()¶
-
mute_post(account, permlink, notes, mod_account)¶ Mutes a post
Parameters: - account (str) – Set role of this account
- permlink (str) – permlink
- notes (str) – permlink
- mod_account (str) – Account who broadcast this, (mods or higher)
-
pin_post(account, permlink, mod_account)¶ Stickes a post to the top of a community
Parameters: - account (str) – post author
- permlink (str) – permlink
- mod_account (str) – Account who broadcast this, (mods or higher)
-
refresh()¶ Refresh/Obtain an community’s data from the API server
-
set_role(account, role, mod_account)¶ Set role for a given account
Parameters: - account (str) – Set role of this account
- role (str) – Can be member, mod, admin, owner, guest
- mod_account (str) – Account who broadcast this, (mods or higher)
-
set_user_title(account, title, mod_account)¶ Set title for a given account
Parameters: - account (str) – Set role of this account
- title (str) – Title
- mod_account (str) – Account who broadcast this, (mods or higher)
-
subscribe(account)¶ subscribe to a community
Parameters: account (str) – account who suscribe to the community (is also broadcasting the custom_json)
-
type_id= 2¶
-
unmute_post(account, permlink, notes, mod_account)¶ Unmute a post
Parameters: - account (str) – post author
- permlink (str) – permlink
- notes (str) – notes
- mod_account (str) – Account who broadcast this, (mods or higher)
-
unpin_post(account, permlink, mod_account)¶ Removes a post from the top of a community
Parameters: - account (str) – post author
- permlink (str) – permlink
- mod_account (str) – Account who broadcast this, (mods or higher)
-
unsubscribe(account)¶ unsubscribe a community
Parameters: account (str) – account who unsuscribe to the community (is also broadcasting the custom_json)
-
update_props(title, about, is_nsfw, description, flag_text, admin_account)¶ Updates the community properties
Parameters: - title (str) – Community title
- about (str) – about
- is_nsfw (bool) – is_nsfw
- description (str) – description
- flag_text (str) – flag_text
- admin_account (str) – Account who broadcast this, (admin or higher)
-