beem.utils

beem.utils.addTzInfo(t, timezone='UTC')

Returns a datetime object with tzinfo added

beem.utils.assets_from_string(text)

Correctly split a string containing an asset pair.

Splits the string into two assets with the separator being on of the following: :, /, or -.

beem.utils.construct_authorperm(*args)

Create a post identifier from comment/post object or arguments. Examples:

>>> from beem.utils import construct_authorperm
>>> print(construct_authorperm('username', 'permlink'))
@username/permlink
>>> print(construct_authorperm({'author': 'username', 'permlink': 'permlink'}))
@username/permlink
beem.utils.construct_authorpermvoter(*args)

Create a vote identifier from vote object or arguments. Examples:

>>> from beem.utils import construct_authorpermvoter
>>> print(construct_authorpermvoter('username', 'permlink', 'voter'))
@username/permlink|voter
>>> print(construct_authorpermvoter({'author': 'username', 'permlink': 'permlink', 'voter': 'voter'}))
@username/permlink|voter
beem.utils.create_new_password(length=32)

Creates a random password containing alphanumeric chars with at least 1 number and 1 upper and lower char

beem.utils.create_yaml_header(comment, json_metadata={}, reply_identifier=None)
beem.utils.derive_beneficiaries(beneficiaries)

Derive a permlink from a comment title (for root level comments) or the parent permlink and optionally the parent author (for replies).

beem.utils.derive_tags(tags)
beem.utils.findall_patch_hunks(body=None)
beem.utils.formatTime(t)

Properly Format Time for permlinks

beem.utils.formatTimeFromNow(secs=0)

Properly Format Time that is x seconds in the future

Parameters:secs (int) – Seconds to go in the future (x>0) or the past (x<0)
Returns:Properly formated time for Graphene (%Y-%m-%dT%H:%M:%S)
Return type:str
beem.utils.formatTimeString(t)

Properly Format Time for permlinks

beem.utils.formatTimedelta(td)

Format timedelta to String

beem.utils.formatToTimeStamp(t)

Returns a timestamp integer

Parameters:t (datetime) – datetime object
Returns:Timestamp as integer
beem.utils.generate_password(import_password, wif=1)
beem.utils.import_coldcard_wif(filename)

Reads a exported coldcard Wif text file and returns the WIF and used path

beem.utils.import_custom_json(jsonid, json_data)
beem.utils.import_pubkeys(import_pub)
beem.utils.load_dirty_json(dirty_json)
beem.utils.make_patch(a, b)
beem.utils.parse_time(block_time)

Take a string representation of time from the blockchain, and parse it into datetime object.

beem.utils.remove_from_dict(obj, keys=[], keep_keys=True)

Prune a class or dictionary of all but keys (keep_keys=True). Prune a class or dictionary of specified keys.(keep_keys=False).

beem.utils.reputation_to_score(rep)

Converts the account reputation value into the reputation score

beem.utils.resolve_authorperm(identifier)

Correctly split a string containing an authorperm.

Splits the string into author and permlink with the following separator: /.

Examples:

>>> from beem.utils import resolve_authorperm
>>> author, permlink = resolve_authorperm('https://d.tube/#!/v/pottlund/m5cqkd1a')
>>> author, permlink = resolve_authorperm("https://steemit.com/witness-category/@gtg/24lfrm-gtg-witness-log")
>>> author, permlink = resolve_authorperm("@gtg/24lfrm-gtg-witness-log")
>>> author, permlink = resolve_authorperm("https://busy.org/@gtg/24lfrm-gtg-witness-log")
beem.utils.resolve_authorpermvoter(identifier)

Correctly split a string containing an authorpermvoter.

Splits the string into author and permlink with the following separator: / and |.

beem.utils.resolve_root_identifier(url)
beem.utils.seperate_yaml_dict_from_body(content)