INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
Check if the element is not focused | def element_not_focused(step, id):
"""
Check if the element is not focused
"""
elem = world.browser.find_element_by_xpath(str('id("{id}")'.format(id=id)))
focused = world.browser.switch_to_active_element()
assert_false(step, elem == focused) |
Check that the form input element has given value. | def input_has_value(step, field_name, value):
"""
Check that the form input element has given value.
"""
with AssertContextManager(step):
text_field = find_any_field(world.browser,
DATE_FIELDS + TEXT_FIELDS,
field_name)
... |
Submit the form having given id. | def submit_form_id(step, id):
"""
Submit the form having given id.
"""
form = world.browser.find_element_by_xpath(str('id("{id}")'.format(id=id)))
form.submit() |
Submit the form having given action URL. | def submit_form_action(step, url):
"""
Submit the form having given action URL.
"""
form = world.browser.find_element_by_xpath(str('//form[@action="%s"]' %
url))
form.submit() |
Check the alert text | def check_alert(step, text):
"""
Check the alert text
"""
try:
alert = Alert(world.browser)
assert_equals(alert.text, text)
except WebDriverException:
# PhantomJS is kinda poor
pass |
Press a button having a given tooltip. | def see_tooltip(step, tooltip):
"""
Press a button having a given tooltip.
"""
elem = world.browser.find_elements_by_xpath(str(
'//*[@title="%(tooltip)s" or @data-original-title="%(tooltip)s"]' %
dict(tooltip=tooltip)))
elem = [e for e in elem if e.is_displayed()]
assert_true(ste... |
Press a button having a given tooltip. | def press_by_tooltip(step, tooltip):
"""
Press a button having a given tooltip.
"""
with AssertContextManager(step):
for button in world.browser.find_elements_by_xpath(str(
'//*[@title="%(tooltip)s" or @data-original-title="%(tooltip)s"]' %
dict(tooltip=tooltip))):
... |
Check that the page title matches the given one. | def page_title(step, title):
"""
Check that the page title matches the given one.
"""
with AssertContextManager(step):
assert_equals(world.browser.title, title) |
Get a list of tags.
:param resource: (optional) Restrict to given resource type as string.
:param sort: (optional) Sort fields to apply as string list.
:return: :class:`tags.Tag <tags.Tag>` list | def list(self, resource=None, sort=None):
"""Get a list of tags.
:param resource: (optional) Restrict to given resource type as string.
:param sort: (optional) Sort fields to apply as string list.
:return: :class:`tags.Tag <tags.Tag>` list
"""
schema = TagSchema()
... |
Get a tag.
:param name: Tag name as string.
:return: :class:`tags.Tag <tags.Tag>` object
:rtype: tags.Tag | def get(self, name):
"""Get a tag.
:param name: Tag name as string.
:return: :class:`tags.Tag <tags.Tag>` object
:rtype: tags.Tag
"""
schema = TagSchema()
resp = self.service.get_id(self.base, name)
return self.service.decode(schema, resp) |
Edit a tag.
:param resource: :class:`tags.Tag <tags.Tag>` object
:return: :class:`tags.Tag <tags.Tag>` object
:rtype: tags.Tag | def edit(self, resource):
"""Edit a tag.
:param resource: :class:`tags.Tag <tags.Tag>` object
:return: :class:`tags.Tag <tags.Tag>` object
:rtype: tags.Tag
"""
schema = TagSchema(only=('name', 'configs', 'devices', 'packages', 'results'))
json = self.service.enco... |
Get the remaining time-to-live of this lease.
:returns: TTL in seconds.
:rtype: int | def remaining(self):
"""
Get the remaining time-to-live of this lease.
:returns: TTL in seconds.
:rtype: int
"""
if self._expired:
raise Expired()
obj = {
u'ID': self.lease_id,
}
data = json.dumps(obj).encode('utf8')
... |
Revokes a lease. All keys attached to the lease will expire
and be deleted.
:returns: Response header.
:rtype: instance of :class:`txaioetcd.Header` | def revoke(self):
"""
Revokes a lease. All keys attached to the lease will expire
and be deleted.
:returns: Response header.
:rtype: instance of :class:`txaioetcd.Header`
"""
if self._expired:
raise Expired()
obj = {
# ID is the l... |
Keeps the lease alive by streaming keep alive requests from the client
to the server and streaming keep alive responses from the server to
the client.
:returns: Response header.
:rtype: instance of :class:`txaioetcd.Header` | def refresh(self):
"""
Keeps the lease alive by streaming keep alive requests from the client
to the server and streaming keep alive responses from the server to
the client.
:returns: Response header.
:rtype: instance of :class:`txaioetcd.Header`
"""
if s... |
Read links and associated categories for specified articles
in text file seperated by a space
Args:
file_path (str): The path to text file with news article links
and category
Returns:
articles: Array of tuples that contains article link & ... | def read_links_file(self,file_path):
'''
Read links and associated categories for specified articles
in text file seperated by a space
Args:
file_path (str): The path to text file with news article links
and category
Returns:
... |
Searches Google News.
NOTE: Official Google News API is deprecated https://developers.google.com/news-search/?hl=en
NOTE: Google limits the maximum number of documents per query to 100.
Use multiple related queries to get a bigger corpus.
Args:
query (str): The search... | def google_news_search(self,query,category_label,num=50):
'''
Searches Google News.
NOTE: Official Google News API is deprecated https://developers.google.com/news-search/?hl=en
NOTE: Google limits the maximum number of documents per query to 100.
Use multiple related queri... |
Makes an RPC call to the server and returns the json response
:param action: RPC method to call
:type action: str
:param params: Dict of arguments to send with RPC call
:type params: dict
:raises: :py:exc:`nano.rpc.RPCException`
:raises: :py:exc:`requests.exceptions.Re... | def call(self, action, params=None):
"""
Makes an RPC call to the server and returns the json response
:param action: RPC method to call
:type action: str
:param params: Dict of arguments to send with RPC call
:type params: dict
:raises: :py:exc:`nano.rpc.RPCEx... |
Process a value that will be sent to backend
:param value: the value to return
:param type: hint for what sort of value this is
:type type: str | def _process_value(self, value, type):
"""
Process a value that will be sent to backend
:param value: the value to return
:param type: hint for what sort of value this is
:type type: str
"""
if not isinstance(value, six.string_types + (list,)):
val... |
Returns how many RAW is owned and how many have not yet been received
by **account**
:param account: Account id to return balance of
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_balance(
... account="xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1... | def account_balance(self, account):
"""
Returns how many RAW is owned and how many have not yet been received
by **account**
:param account: Account id to return balance of
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_balance(
... |
Returns how many RAW is owned and how many have not yet been received
by **accounts** list
:param accounts: list of accounts to return balances for
:type accounts: list of str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.accounts_balances(
... accounts=[
... | def accounts_balances(self, accounts):
"""
Returns how many RAW is owned and how many have not yet been received
by **accounts** list
:param accounts: list of accounts to return balances for
:type accounts: list of str
:raises: :py:exc:`nano.rpc.RPCException`
>... |
Get number of blocks for a specific **account**
:param account: Account to get number of blocks for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_block_count(account="xrb_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3")
19 | def account_block_count(self, account):
"""
Get number of blocks for a specific **account**
:param account: Account to get number of blocks for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_block_count(account="xrb_3t6k35gi95xu6tergt6p69ck... |
Creates new accounts, insert next deterministic keys in **wallet** up
to **count**
.. enable_control required
.. version 8.0 required
:param wallet: Wallet to create new accounts in
:type wallet: str
:param count: Number of accounts to create
:type count: int
... | def accounts_create(self, wallet, count, work=True):
"""
Creates new accounts, insert next deterministic keys in **wallet** up
to **count**
.. enable_control required
.. version 8.0 required
:param wallet: Wallet to create new accounts in
:type wallet: str
... |
Returns a list of pairs of account and block hash representing the
head block for **accounts** list
:param accounts: Accounts to return frontier blocks for
:type accounts: list of str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.accounts_frontiers(
... accounts... | def accounts_frontiers(self, accounts):
"""
Returns a list of pairs of account and block hash representing the
head block for **accounts** list
:param accounts: Accounts to return frontier blocks for
:type accounts: list of str
:raises: :py:exc:`nano.rpc.RPCException`
... |
Returns frontier, open block, change representative block, balance,
last modified timestamp from local database & block count for
**account**
:param account: Account to return info for
:type account: str
:param representative: if True, also returns the representative block
... | def account_info(self, account, representative=False, weight=False, pending=False):
"""
Returns frontier, open block, change representative block, balance,
last modified timestamp from local database & block count for
**account**
:param account: Account to return info for
... |
Creates a new account, insert next deterministic key in **wallet**
.. enable_control required
:param wallet: Wallet to insert new account into
:type wallet: str
:param work: If false, disables work generation after creating account
:type work: bool
:raises: :py:exc:`n... | def account_create(self, wallet, work=True):
"""
Creates a new account, insert next deterministic key in **wallet**
.. enable_control required
:param wallet: Wallet to insert new account into
:type wallet: str
:param work: If false, disables work generation after creat... |
Get account number for the **public key**
:param key: Public key to get account for
:type key: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_get(
... key="3068BB1CA04525BB0E416C485FE6A67FD52540227D267CC8B6E8DA958A7FA039"
... )
"xrb_1e5aqegc1jb... | def account_get(self, key):
"""
Get account number for the **public key**
:param key: Public key to get account for
:type key: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_get(
... key="3068BB1CA04525BB0E416C485FE6A67FD52540227D267CC8B6E8DA95... |
Reports send/receive information for a **account**
:param account: Account to get send/receive information for
:type account: str
:param count: number of blocks to return
:type count: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_history(
... ... | def account_history(self, account, count):
"""
Reports send/receive information for a **account**
:param account: Account to get send/receive information for
:type account: str
:param count: number of blocks to return
:type count: int
:raises: :py:exc:`nano.rpc... |
Lists all the accounts inside **wallet**
:param wallet: Wallet to get account list for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_list(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"
... )
[
... | def account_list(self, wallet):
"""
Lists all the accounts inside **wallet**
:param wallet: Wallet to get account list for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_list(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B... |
Moves **accounts** from **source** to **wallet**
.. enable_control required
:param source: wallet to move accounts from
:type source: str
:param wallet: wallet to move accounts to
:type wallet: str
:param accounts: accounts to move
:type accounts: list of str
... | def account_move(self, source, wallet, accounts):
"""
Moves **accounts** from **source** to **wallet**
.. enable_control required
:param source: wallet to move accounts from
:type source: str
:param wallet: wallet to move accounts to
:type wallet: str
... |
Returns a list of block hashes which have not yet been received by
these **accounts**
:param accounts: Accounts to return list of block hashes for
:type accounts: list of str
:param count: Max number of blocks to returns
:type count: int
:param threshold: Minimum amoun... | def accounts_pending(self, accounts, count=None, threshold=None, source=False):
"""
Returns a list of block hashes which have not yet been received by
these **accounts**
:param accounts: Accounts to return list of block hashes for
:type accounts: list of str
:param coun... |
Get the public key for **account**
:param account: Account to get public key for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_key(
... account="xrb_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx"
... )
"3068BB1CA... | def account_key(self, account):
"""
Get the public key for **account**
:param account: Account to get public key for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_key(
... account="xrb_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft... |
Remove **account** from **wallet**
.. enable_control required
:param wallet: Wallet to remove account from
:type wallet: str
:param account: Account to remove
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_remove(
... ... | def account_remove(self, wallet, account):
"""
Remove **account** from **wallet**
.. enable_control required
:param wallet: Wallet to remove account from
:type wallet: str
:param account: Account to remove
:type account: str
:raises: :py:exc:`nano.rpc.... |
Returns the representative for **account**
:param account: Account to get representative for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_representative(
... account="xrb_39a73oy5ungrhxy5z5oao1xso4zo7dmgpjd4u74xcrx3r1w6rtazuouw6qfi"
)... | def account_representative(self, account):
"""
Returns the representative for **account**
:param account: Account to get representative for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_representative(
... account="xrb_39a73oy5... |
Sets the representative for **account** in **wallet**
.. enable_control required
:param wallet: Wallet to use for account
:type wallet: str
:param account: Account to set representative for
:type account: str
:param representative: Representative to set to
:ty... | def account_representative_set(self, wallet, account, representative, work=None):
"""
Sets the representative for **account** in **wallet**
.. enable_control required
:param wallet: Wallet to use for account
:type wallet: str
:param account: Account to set representati... |
Returns the voting weight for **account**
:param account: Account to get voting weight for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_weight(
... account="xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000"
... )
... | def account_weight(self, account):
"""
Returns the voting weight for **account**
:param account: Account to get voting weight for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_weight(
... account="xrb_3e3j5tkog48pnny9dmfzj1r16p... |
Retrieves a json representation of **block**
:param hash: Hash of block to return representation for
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.block(
... hash="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"
... )
{
... | def block(self, hash):
"""
Retrieves a json representation of **block**
:param hash: Hash of block to return representation for
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.block(
... hash="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B... |
Retrieves a json representations of **blocks**
:param hashes: List of block hashes to return
:type hashes: list of str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.blocks(
... hashes=["000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"]
... )
... | def blocks(self, hashes):
"""
Retrieves a json representations of **blocks**
:param hashes: List of block hashes to return
:type hashes: list of str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.blocks(
... hashes=["000D1BAEC8EC208142C99059B393051BAC8380... |
Retrieves a json representations of **blocks** with transaction
**amount** & block **account**
:param hashes: List of block hashes to return info for
:type hashes: list of str
:param pending: If true, returns pending amount as well
:type pending: bool
:param source: If... | def blocks_info(self, hashes, pending=False, source=False):
"""
Retrieves a json representations of **blocks** with transaction
**amount** & block **account**
:param hashes: List of block hashes to return info for
:type hashes: list of str
:param pending: If true, retur... |
Returns the account containing block
:param hash: Hash of the block to return account for
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.block_account(
... hash="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"
... )
"xrb_... | def block_account(self, hash):
"""
Returns the account containing block
:param hash: Hash of the block to return account for
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.block_account(
... hash="000D1BAEC8EC208142C99059B393051BAC8380F9B5... |
Reports the number of blocks in the ledger and unchecked synchronizing
blocks
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.block_count()
{
"count": 1000,
"unchecked": 10
} | def block_count(self):
"""
Reports the number of blocks in the ledger and unchecked synchronizing
blocks
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.block_count()
{
"count": 1000,
"unchecked": 10
}
"""
resp = self.call(... |
Reports the number of blocks in the ledger by type (send, receive,
open, change)
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.block_count_type()
{
"send": 1000,
"receive": 900,
"open": 100,
"change": 50
} | def block_count_type(self):
"""
Reports the number of blocks in the ledger by type (send, receive,
open, change)
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.block_count_type()
{
"send": 1000,
"receive": 900,
"open": 100,
"cha... |
Creates a json representations of new block based on input data &
signed with private key or account in **wallet** for offline signing
.. enable_control required
.. version 8.1 required
:param type: Type of block to create one of **open**, **receive**,
**change**, ... | def block_create(
self,
type,
account,
wallet=None,
representative=None,
key=None,
destination=None,
amount=None,
balance=None,
previous=None,
source=None,
work=None,
):
"""
Creates a json representations... |
Initialize bootstrap to specific **IP address** and **port**
:param address: Ip address to bootstrap
:type address: str
:param port: Port to bootstrap
:type port: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.bootstrap(address="::ffff:138.201.94.249", port="707... | def bootstrap(self, address, port):
"""
Initialize bootstrap to specific **IP address** and **port**
:param address: Ip address to bootstrap
:type address: str
:param port: Port to bootstrap
:type port: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> ... |
Returns a list of block hashes in the account chain starting at
**block** up to **count**
:param block: Block hash to start at
:type block: str
:param count: Number of blocks to return up to
:type count: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.cha... | def chain(self, block, count):
"""
Returns a list of block hashes in the account chain starting at
**block** up to **count**
:param block: Block hash to start at
:type block: str
:param count: Number of blocks to return up to
:type count: int
:raises: :... |
Returns a list of pairs of delegator names given **account** a
representative and its balance
.. version 8.0 required
:param account: Account to return delegators for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.delegators(
... accou... | def delegators(self, account):
"""
Returns a list of pairs of delegator names given **account** a
representative and its balance
.. version 8.0 required
:param account: Account to return delegators for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`... |
Get number of delegators for a specific representative **account**
.. version 8.0 required
:param account: Account to get number of delegators for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.delegators_count(
... account="xrb_11111111111111... | def delegators_count(self, account):
"""
Get number of delegators for a specific representative **account**
.. version 8.0 required
:param account: Account to get number of delegators for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.dele... |
Derive deterministic keypair from **seed** based on **index**
:param seed: Seed used to get keypair
:type seed: str
:param index: Index of the generated keypair
:type index: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.deterministic_key(
... seed="... | def deterministic_key(self, seed, index):
"""
Derive deterministic keypair from **seed** based on **index**
:param seed: Seed used to get keypair
:type seed: str
:param index: Index of the generated keypair
:type index: int
:raises: :py:exc:`nano.rpc.RPCExcepti... |
Returns a list of pairs of account and block hash representing the
head block starting at **account** up to **count**
:param account: Account to get frontier blocks for
:type account: str
:param count: Max amount to return
:type count: int
:raises: :py:exc:`nano.rpc.RP... | def frontiers(self, account, count):
"""
Returns a list of pairs of account and block hash representing the
head block starting at **account** up to **count**
:param account: Account to get frontier blocks for
:type account: str
:param count: Max amount to return
... |
Reports send/receive information for a chain of blocks
:param hash: Hash of block to receive history for
:type hash: str
:param count: Max number of blocks to return
:type count: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.history(
... hash="000D1... | def history(self, hash, count):
"""
Reports send/receive information for a chain of blocks
:param hash: Hash of block to receive history for
:type hash: str
:param count: Max number of blocks to return
:type count: int
:raises: :py:exc:`nano.rpc.RPCException`
... |
Divide a raw amount down by the Mrai ratio.
:param amount: Amount in raw to convert to Mrai
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.mrai_from_raw(amount=1000000000000000000000000000000)
1 | def mrai_from_raw(self, amount):
"""
Divide a raw amount down by the Mrai ratio.
:param amount: Amount in raw to convert to Mrai
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.mrai_from_raw(amount=1000000000000000000000000000000)
1
... |
Multiply an Mrai amount by the Mrai ratio.
:param amount: Amount in Mrai to convert to raw
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.mrai_to_raw(amount=1)
1000000000000000000000000000000 | def mrai_to_raw(self, amount):
"""
Multiply an Mrai amount by the Mrai ratio.
:param amount: Amount in Mrai to convert to raw
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.mrai_to_raw(amount=1)
1000000000000000000000000000000
"""
... |
Divide a raw amount down by the krai ratio.
:param amount: Amount in raw to convert to krai
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.krai_from_raw(amount=1000000000000000000000000000)
1 | def krai_from_raw(self, amount):
"""
Divide a raw amount down by the krai ratio.
:param amount: Amount in raw to convert to krai
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.krai_from_raw(amount=1000000000000000000000000000)
1
"""
... |
Multiply an krai amount by the krai ratio.
:param amount: Amount in krai to convert to raw
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.krai_to_raw(amount=1)
1000000000000000000000000000 | def krai_to_raw(self, amount):
"""
Multiply an krai amount by the krai ratio.
:param amount: Amount in krai to convert to raw
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.krai_to_raw(amount=1)
1000000000000000000000000000
"""
... |
Divide a raw amount down by the rai ratio.
:param amount: Amount in raw to convert to rai
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.rai_from_raw(amount=1000000000000000000000000)
1 | def rai_from_raw(self, amount):
"""
Divide a raw amount down by the rai ratio.
:param amount: Amount in raw to convert to rai
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.rai_from_raw(amount=1000000000000000000000000)
1
"""
... |
Multiply an rai amount by the rai ratio.
:param amount: Amount in rai to convert to raw
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.rai_to_raw(amount=1)
1000000000000000000000000 | def rai_to_raw(self, amount):
"""
Multiply an rai amount by the rai ratio.
:param amount: Amount in rai to convert to raw
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.rai_to_raw(amount=1)
1000000000000000000000000
"""
amo... |
Derive public key and account number from **private key**
:param key: Private key to generate account and public key of
:type key: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.key_expand(
key="781186FB9EF17DB6E3D1056550D9FAE5D5BBADA6A6BC370E4CBB938B1DC71DA3"
... | def key_expand(self, key):
"""
Derive public key and account number from **private key**
:param key: Private key to generate account and public key of
:type key: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.key_expand(
key="781186FB9EF17DB6E3D105655... |
Tells the node to send a keepalive packet to **address**:**port**
.. enable_control required
:param address: IP address of node to send keepalive packet to
:type address: str
:param port: Port of node to send keepalive packet to
:type port: int
:raises: :py:exc:`nano.... | def keepalive(self, address, port):
"""
Tells the node to send a keepalive packet to **address**:**port**
.. enable_control required
:param address: IP address of node to send keepalive packet to
:type address: str
:param port: Port of node to send keepalive packet to
... |
Returns frontier, open block, change representative block, balance,
last modified timestamp from local database & block count starting at
**account** up to **count**
.. enable_control required
.. version 8.0 required
:param account: Account to return blocks for
:type ac... | def ledger(
self,
account,
count=None,
representative=False,
weight=False,
pending=False,
sorting=False,
):
"""
Returns frontier, open block, change representative block, balance,
last modified timestamp from local database & block coun... |
Begin a new payment session. Searches wallet for an account that's
marked as available and has a 0 balance. If one is found, the account
number is returned and is marked as unavailable. If no account is
found, a new account is created, placed in the wallet, and returned.
:param wallet: ... | def payment_begin(self, wallet):
"""
Begin a new payment session. Searches wallet for an account that's
marked as available and has a 0 balance. If one is found, the account
number is returned and is marked as unavailable. If no account is
found, a new account is created, placed ... |
Marks all accounts in wallet as available for being used as a payment
session.
:param wallet: Wallet to init payment in
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.payment_init(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A... | def payment_init(self, wallet):
"""
Marks all accounts in wallet as available for being used as a payment
session.
:param wallet: Wallet to init payment in
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.payment_init(
... wallet="... |
End a payment session. Marks the account as available for use in a
payment session.
:param account: Account to mark available
:type account: str
:param wallet: Wallet to end payment session for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rp... | def payment_end(self, account, wallet):
"""
End a payment session. Marks the account as available for use in a
payment session.
:param account: Account to mark available
:type account: str
:param wallet: Wallet to end payment session for
:type wallet: str
... |
Wait for payment of **amount** to arrive in **account** or until **timeout**
milliseconds have elapsed.
:param account: Account to wait for payment
:type account: str
:param amount: Amount in raw of funds to wait for payment to arrive
:type amount: int
:param timeout: ... | def payment_wait(self, account, amount, timeout):
"""
Wait for payment of **amount** to arrive in **account** or until **timeout**
milliseconds have elapsed.
:param account: Account to wait for payment
:type account: str
:param amount: Amount in raw of funds to wait for... |
Publish **block** to the network
:param block: Block to publish
:type block: dict or json
:raises: :py:exc:`nano.rpc.RPCException`
>>> block = {
"account": "xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000",
"work": "0000000000000000",
... | def process(self, block):
"""
Publish **block** to the network
:param block: Block to publish
:type block: dict or json
:raises: :py:exc:`nano.rpc.RPCException`
>>> block = {
"account": "xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000",
... |
Receive pending **block** for **account** in **wallet**
.. enable_control required
:param wallet: Wallet of account to receive block for
:type wallet: str
:param account: Account to receive block for
:type account: str
:param block: Block hash to receive
:type... | def receive(self, wallet, account, block, work=None):
"""
Receive pending **block** for **account** in **wallet**
.. enable_control required
:param wallet: Wallet of account to receive block for
:type wallet: str
:param account: Account to receive block for
:ty... |
Set **amount** as new receive minimum for node until restart
.. enable_control required
.. version 8.0 required
:param amount: Amount in raw to set as minimum to receive
:type amount: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.receive_minimum_set(amount=1000... | def receive_minimum_set(self, amount):
"""
Set **amount** as new receive minimum for node until restart
.. enable_control required
.. version 8.0 required
:param amount: Amount in raw to set as minimum to receive
:type amount: int
:raises: :py:exc:`nano.rpc.RPC... |
Returns a list of pairs of representative and its voting weight
:param count: Max amount of representatives to return
:type count: int
:param sorting: If true, sorts by weight
:type sorting: bool
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.representatives()
... | def representatives(self, count=None, sorting=False):
"""
Returns a list of pairs of representative and its voting weight
:param count: Max amount of representatives to return
:type count: int
:param sorting: If true, sorts by weight
:type sorting: bool
:raises... |
Returns a list of pairs of unchecked synchronizing block hash and its
json representation up to **count**
.. version 8.0 required
:param count: Max amount of unchecked blocks to return
:type count: int
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.unchecked(count=1... | def unchecked(self, count=None):
"""
Returns a list of pairs of unchecked synchronizing block hash and its
json representation up to **count**
.. version 8.0 required
:param count: Max amount of unchecked blocks to return
:type count: int
:raises: :py:exc:`nano... |
Retrieves unchecked database keys, blocks hashes & a json
representations of unchecked pending blocks starting from **key** up
to **count**
.. version 8.0 required
:param key: Starting key to return unchecked keys for
:type key: str
:param count: Max number of keys/blo... | def unchecked_keys(self, key=None, count=None):
"""
Retrieves unchecked database keys, blocks hashes & a json
representations of unchecked pending blocks starting from **key** up
to **count**
.. version 8.0 required
:param key: Starting key to return unchecked keys for
... |
Check whether **account** is a valid account number
:param account: Account number to check
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.validate_account_number(
... account="xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000"
.... | def validate_account_number(self, account):
"""
Check whether **account** is a valid account number
:param account: Account number to check
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.validate_account_number(
... account="xrb_3e3j5tk... |
Returns the default representative for **wallet**
:param wallet: Wallet to get default representative account for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_representative(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D8... | def wallet_representative(self, wallet):
"""
Returns the default representative for **wallet**
:param wallet: Wallet to get default representative account for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_representative(
... wall... |
Sets the default **representative** for **wallet**
.. enable_control required
:param wallet: Wallet to set default representative account for
:type wallet: str
:param representative: Representative account to set for **wallet**
:type representative: str
:raises: :py:e... | def wallet_representative_set(self, wallet, representative):
"""
Sets the default **representative** for **wallet**
.. enable_control required
:param wallet: Wallet to set default representative account for
:type wallet: str
:param representative: Representative accoun... |
Add an adhoc private key **key** to **wallet**
.. enable_control required
:param wallet: Wallet to add private key to
:type wallet: str
:param key: Private key to add
:type key: str
:param work: If false, disables work generation
:type work: bool
:rai... | def wallet_add(self, wallet, key, work=True):
"""
Add an adhoc private key **key** to **wallet**
.. enable_control required
:param wallet: Wallet to add private key to
:type wallet: str
:param key: Private key to add
:type key: str
:param work: If fals... |
Returns the sum of all accounts balances in **wallet**
:param wallet: Wallet to return sum of balances for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_balance_total(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"... | def wallet_balance_total(self, wallet):
"""
Returns the sum of all accounts balances in **wallet**
:param wallet: Wallet to return sum of balances for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_balance_total(
... wallet="000D1... |
Returns how many rai is owned and how many have not yet been received
by all accounts in **wallet**
:param wallet: Wallet to return balances for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_balances(
... wallet="000D1BAEC8EC208142C99059... | def wallet_balances(self, wallet):
"""
Returns how many rai is owned and how many have not yet been received
by all accounts in **wallet**
:param wallet: Wallet to return balances for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_bal... |
Changes seed for **wallet** to **seed**
.. enable_control required
:param wallet: Wallet to change seed for
:type wallet: str
:param seed: Seed to change wallet to
:type seed: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_change_seed(
..... | def wallet_change_seed(self, wallet, seed):
"""
Changes seed for **wallet** to **seed**
.. enable_control required
:param wallet: Wallet to change seed for
:type wallet: str
:param seed: Seed to change wallet to
:type seed: str
:raises: :py:exc:`nano.r... |
Check whether **wallet** contains **account**
:param wallet: Wallet to check contains **account**
:type wallet: str
:param account: Account to check exists in **wallet**
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_contains(
... ... | def wallet_contains(self, wallet, account):
"""
Check whether **wallet** contains **account**
:param wallet: Wallet to check contains **account**
:type wallet: str
:param account: Account to check exists in **wallet**
:type account: str
:raises: :py:exc:`nano.r... |
Destroys **wallet** and all contained accounts
.. enable_control required
:param wallet: Wallet to destroy
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_destroy(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F... | def wallet_destroy(self, wallet):
"""
Destroys **wallet** and all contained accounts
.. enable_control required
:param wallet: Wallet to destroy
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_destroy(
... wallet="000D1BAE... |
Return a json representation of **wallet**
:param wallet: Wallet to export
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_export(wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F")
{
"0000000000000000000000000000000... | def wallet_export(self, wallet):
"""
Return a json representation of **wallet**
:param wallet: Wallet to export
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_export(wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F")
... |
Returns a list of pairs of account and block hash representing the
head block starting for accounts from **wallet**
:param wallet: Wallet to return frontiers for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_frontiers(
... wallet="000D1B... | def wallet_frontiers(self, wallet):
"""
Returns a list of pairs of account and block hash representing the
head block starting for accounts from **wallet**
:param wallet: Wallet to return frontiers for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
... |
Returns if a **wallet** key is valid
:param wallet: Wallet to check key is valid
:type wallet: str
>>> rpc.wallet_key_valid(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"
... )
True | def wallet_key_valid(self, wallet):
"""
Returns if a **wallet** key is valid
:param wallet: Wallet to check key is valid
:type wallet: str
>>> rpc.wallet_key_valid(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"
... )
T... |
Locks a **wallet**
:param wallet: Wallet to lock
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_lock(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"
... )
True | def wallet_lock(self, wallet):
"""
Locks a **wallet**
:param wallet: Wallet to lock
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_lock(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"
... )
... |
Checks whether **wallet** is locked
:param wallet: Wallet to check if locked
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_locked(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"
... )
False | def wallet_locked(self, wallet):
"""
Checks whether **wallet** is locked
:param wallet: Wallet to check if locked
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_locked(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B24... |
Unlocks **wallet** using **password**
:param wallet: Wallet to unlock
:type wallet: str
:param password: Password to enter
:type password: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_unlock(
... wallet="000D1BAEC8EC208142C99059B393051BAC838... | def wallet_unlock(self, wallet, password):
"""
Unlocks **wallet** using **password**
:param wallet: Wallet to unlock
:type wallet: str
:param password: Password to enter
:type password: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_unlock... |
Rebroadcast blocks for accounts from **wallet** starting at frontier
down to **count** to the network
.. enable_control required
.. version 8.0 required
:param wallet: Wallet to rebroadcast blocks for
:type wallet: str
:param count: Max amount of blocks to rebroadcast ... | def wallet_republish(self, wallet, count):
"""
Rebroadcast blocks for accounts from **wallet** starting at frontier
down to **count** to the network
.. enable_control required
.. version 8.0 required
:param wallet: Wallet to rebroadcast blocks for
:type wallet: ... |
Returns a list of pairs of account and work from **wallet**
.. enable_control required
.. version 8.0 required
:param wallet: Wallet to return work for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.wallet_work_get(
... wallet="000D1BAE... | def wallet_work_get(self, wallet):
"""
Returns a list of pairs of account and work from **wallet**
.. enable_control required
.. version 8.0 required
:param wallet: Wallet to return work for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>... |
Changes the password for **wallet** to **password**
.. enable_control required
:param wallet: Wallet to change password for
:type wallet: str
:param password: Password to set
:type password: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.password_change... | def password_change(self, wallet, password):
"""
Changes the password for **wallet** to **password**
.. enable_control required
:param wallet: Wallet to change password for
:type wallet: str
:param password: Password to set
:type password: str
:raises:... |
Enters the **password** in to **wallet**
:param wallet: Wallet to enter password for
:type wallet: str
:param password: Password to enter
:type password: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.password_enter(
... wallet="000D1BAEC8EC208142C99... | def password_enter(self, wallet, password):
"""
Enters the **password** in to **wallet**
:param wallet: Wallet to enter password for
:type wallet: str
:param password: Password to enter
:type password: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> r... |
Checks whether the password entered for **wallet** is valid
:param wallet: Wallet to check password for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.password_valid(
... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F"
... | def password_valid(self, wallet):
"""
Checks whether the password entered for **wallet** is valid
:param wallet: Wallet to check password for
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.password_valid(
... wallet="000D1BAEC8EC208142C9... |
Returns a list of pairs of peer IPv6:port and its node network version
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.peers()
{
"[::ffff:172.17.0.1]:32841": 3
} | def peers(self):
"""
Returns a list of pairs of peer IPv6:port and its node network version
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.peers()
{
"[::ffff:172.17.0.1]:32841": 3
}
"""
resp = self.call('peers')
result = {}
... |
Check whether block is pending by **hash**
.. version 8.0 required
:param hash: Hash of block to check if pending
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.pending_exists(
hash="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3... | def pending_exists(self, hash):
"""
Check whether block is pending by **hash**
.. version 8.0 required
:param hash: Hash of block to check if pending
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.pending_exists(
hash="000D1BAEC8E... |
Stop generating **work** for block
.. enable_control required
:param hash: Hash to stop generating work for
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.work_cancel(
... hash="718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2"
... | def work_cancel(self, hash):
"""
Stop generating **work** for block
.. enable_control required
:param hash: Hash to stop generating work for
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.work_cancel(
... hash="718CC2121C3E641059B... |
Generates **work** for block
.. enable_control required
:param hash: Hash to start generating **work** for
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.work_generate(
... hash="718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2"
... | def work_generate(self, hash):
"""
Generates **work** for block
.. enable_control required
:param hash: Hash to start generating **work** for
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.work_generate(
... hash="718CC2121C3E6410... |
Retrieves work for **account** in **wallet**
.. enable_control required
.. version 8.0 required
:param wallet: Wallet to get account work for
:type wallet: str
:param account: Account to get work for
:type account: str
:raises: :py:exc:`nano.rpc.RPCException`
... | def work_get(self, wallet, account):
"""
Retrieves work for **account** in **wallet**
.. enable_control required
.. version 8.0 required
:param wallet: Wallet to get account work for
:type wallet: str
:param account: Account to get work for
:type accoun... |
Set **work** for **account** in **wallet**
.. enable_control required
.. version 8.0 required
:param wallet: Wallet to set work for account for
:type wallet: str
:param account: Account to set work for
:type account: str
:param work: Work to set for account in... | def work_set(self, wallet, account, work):
"""
Set **work** for **account** in **wallet**
.. enable_control required
.. version 8.0 required
:param wallet: Wallet to set work for account for
:type wallet: str
:param account: Account to set work for
:typ... |
Add specific **IP address** and **port** as work peer for node until
restart
.. enable_control required
.. version 8.0 required
:param address: IP address of work peer to add
:type address: str
:param port: Port work peer to add
:type port: int
:raises... | def work_peer_add(self, address, port):
"""
Add specific **IP address** and **port** as work peer for node until
restart
.. enable_control required
.. version 8.0 required
:param address: IP address of work peer to add
:type address: str
:param port: Po... |
Check whether **work** is valid for block
:param work: Work to validate
:type work: str
:param hash: Hash of block to validate work for
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.work_validate(
... work="2bf29ef00786a6bc",
...... | def work_validate(self, work, hash):
"""
Check whether **work** is valid for block
:param work: Work to validate
:type work: str
:param hash: Hash of block to validate work for
:type hash: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.work_valid... |
Rebroadcast blocks starting at **hash** to the network
:param hash: Hash of block to start rebroadcasting from
:type hash: str
:param count: Max number of blocks to rebroadcast
:type count: int
:param sources: If set, additionally rebroadcasts source chain blocks
... | def republish(self, hash, count=None, sources=None, destinations=None):
"""
Rebroadcast blocks starting at **hash** to the network
:param hash: Hash of block to start rebroadcasting from
:type hash: str
:param count: Max number of blocks to rebroadcast
:type count: int
... |
Tells the node to look for pending blocks for any account in
**wallet**
.. enable_control required
:param wallet: Wallet to search for pending blocks
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.search_pending(
... wallet="000D1BAEC8E... | def search_pending(self, wallet):
"""
Tells the node to look for pending blocks for any account in
**wallet**
.. enable_control required
:param wallet: Wallet to search for pending blocks
:type wallet: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> r... |
Send **amount** from **source** in **wallet** to **destination**
.. enable_control required
:param wallet: Wallet of account used to send funds
:type wallet: str
:param source: Account to send funds from
:type source: str
:param destination: Account to send funds to
... | def send(self, wallet, source, destination, amount, work=None, id=None):
"""
Send **amount** from **source** in **wallet** to **destination**
.. enable_control required
:param wallet: Wallet of account used to send funds
:type wallet: str
:param source: Account to send... |
Returns the node's RPC version
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.version()
{
"rpc_version": 1,
"store_version": 10,
"node_vendor": "RaiBlocks 9.0"
} | def version(self):
"""
Returns the node's RPC version
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.version()
{
"rpc_version": 1,
"store_version": 10,
"node_vendor": "RaiBlocks 9.0"
}
"""
resp = self.call('version... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.