PolySwarm Client Source-Based Documentation¶
API Reference¶
This page contains auto-generated API reference documentation 1.
balancemanager
¶
Submodules¶
balancemanager.__main__
¶
Module Contents¶
-
balancemanager.__main__.
cli
(log, client_log, log_format)[source]¶ -
Entrypoint for the balance manager driver
- Parameters
log (str) – Log level for balancemanger module logs
client_log (str) – Log level for all polyswarmclient module logs
log_format (str) – Choose either json, or text log format
-
balancemanager.__main__.
deposit
(polyswarmd_addr, keyfile, password, api_key, testing, insecure_transport, denomination, all, amount)[source]¶ -
Entrypoint to deposit NCT into a sidechain
- Parameters
polyswarmd_addr (str) – Address for the polyswarmd server
keyfile (str) – Path to the keyfile
password (str) – Password to unlock keyfile
api_key (str) – ApiKey to access polyswarmd
testing (int) – Number of tests to run
insecure_transport (bool) – Flag to allow use of http instead of https
denomination (str) – Choose to interpret amount as nct, nct-gwei, or nct-wei
all (bool) – Choose to deposit the entire homechain balance
amount (float) – Amount of Nectar (NCT) to transfer
-
balancemanager.__main__.
withdraw
(polyswarmd_addr, keyfile, password, api_key, testing, insecure_transport, denomination, all, amount)[source]¶ -
Entrypoint to withdraw NCT from a sidechain into the homechain
- Parameters
polyswarmd_addr (str) – Address for the polyswarmd server
keyfile (str) – Path to the keyfile
password (str) – Password to unlock keyfile
api_key (str) – ApiKey to access polyswarmd
testing (int) – Number of tests to run
insecure_transport (bool) – Flag to allow use of http instead of https
denomination (str) – Choose to interpret amount as nct, nct-gwei, or nct-wei
all (bool) – Choose to withdraw the entire sidechain balance
amount (float) – Amount of Nectar (NCT) to transfer (if not all)
-
balancemanager.__main__.
maintain
(polyswarmd_addr, keyfile, password, api_key, testing, insecure_transport, denomination, maximum, withdraw_target, confirmations, minimum, refill_amount)[source]¶ -
Entrypoint to withdraw NCT from a sidechain into the homechain
- Parameters
polyswarmd_addr (str) – Address for the polyswarmd server
keyfile (str) – Path to the keyfile
password (str) – Password to unlock keyfile
api_key (str) – ApiKey to access polyswarmd
testing (int) – Number of tests to run
insecure_transport (bool) – Flag to allow use of http instead of https
denomination (str) – Choose to interpret amount as nct, nct-gwei, or nct-wei
maximum (int) – Maximum balance to before starting a withdrawal from sidechain
withdraw_target (int) – Target value after performing a withdrawal
confirmations (int) – Number of confirmations to wait to confirm a transfer occurred
minimum (float) – Value of NCT on sidechain where you want to transfer more NCT
refill_amount (float) – Value of NCT to transfer anytime the balance falls below the minimum
Package Contents¶
-
balancemanager.
convert
(client, denomination, amount)[source]¶ -
Convert the amount from it's original precision to 18 decimals
-
class
balancemanager.
BalanceManager
(client, denomination, transfer_all, amount, testing=0, chains=None)[source]¶ Bases:
object
Balance manager is used for single transfer events in either direction. Create a client, choose a chain and amount then run it.
-
class
balancemanager.
Deposit
(client, denomination, transfer_all, amount, testing=0)[source]¶ Bases:
balancemanager.BalanceManager
Deposit only version of Balance Manager
-
class
balancemanager.
Withdraw
(client, denomination, transfer_all, amount, testing=0)[source]¶ Bases:
balancemanager.BalanceManager
Withdraw only version of Balance Manager
-
class
balancemanager.
Maintainer
(client, denomination, confirmations, minimum, refill_amount, maximum, withdraw_target, testing=0)[source]¶ Bases:
object
This class maintains a balance on the sidechain. It requires a base setup of a minimum balance. Optionally, it can take a maximum balance, so that earnings can automatically be transferred back to the homechain.
polyswarmclient
¶
Submodules¶
polyswarmclient.abstractambassador
¶
Module Contents¶
-
class
polyswarmclient.abstractambassador.
QueuedBounty
(artifact_type, amount, ipfs_uri, duration, api_key=None)[source]¶ Bases:
object
-
class
polyswarmclient.abstractambassador.
AbstractAmbassador
(client, testing=0, chains=None, watchdog=0, submission_rate=0)[source]¶ Bases:
abc.ABC
-
classmethod
connect
(cls, polyswarmd_addr, keyfile, password, api_key=None, testing=0, insecure_transport=False, chains=None, watchdog=0, submission_rate=0)[source]¶ Connect the Ambassador to a Client.
- Parameters
polyswarmd_addr (str) – URL of polyswarmd you are referring to.
keyfile (str) – Keyfile filename.
password (str) – Password associated with Keyfile.
api_key (str) – Your PolySwarm API key.
testing (int) – Number of testing bounties to use.
insecure_transport (bool) – Allow insecure transport such as HTTP?
chains (set(str)) – Set of chains you are acting on.
- Returns
Ambassador instantiated with a Client.
- Return type
-
classmethod
polyswarmclient.abstractarbiter
¶
Module Contents¶
-
class
polyswarmclient.abstractarbiter.
AbstractArbiter
(client, testing=0, scanner=None, chains=None, artifact_types=None)[source]¶ Bases:
object
-
classmethod
connect
(cls, polyswarmd_addr, keyfile, password, api_key=None, testing=0, insecure_transport=False, scanner=None, chains=None, artifact_types=None)[source]¶ Connect the Arbiter to a Client.
- Parameters
polyswarmd_addr (str) – URL of polyswarmd you are referring to.
keyfile (str) – Keyfile filename.
password (str) – Password associated with Keyfile.
api_key (str) – Your PolySwarm API key.
testing (int) – Number of testing bounties to use.
insecure_transport (bool) – Allow insecure transport such as HTTP?
scanner (AbstractScanner) – Scanner for scanning artifacts
chains (set(str)) – Set of chains you are acting on.
artifact_types (list(ArtifactType)) – List of artifact types you support
- Returns
Arbiter instantiated with a Client.
- Return type
-
classmethod
polyswarmclient.abstractmicroengine
¶
Module Contents¶
-
class
polyswarmclient.abstractmicroengine.
AbstractMicroengine
(client, testing=0, scanner=None, chains=None, artifact_types=None)[source]¶ Bases:
object
-
classmethod
connect
(cls, polyswarmd_addr, keyfile, password, api_key=None, testing=0, insecure_transport=False, scanner=None, chains=None, artifact_types=None)[source]¶ Connect the Microengine to a Client.
- Parameters
polyswarmd_addr (str) – URL of polyswarmd you are referring to.
keyfile (str) – Keyfile filename.
password (str) – Password associated with Keyfile.
api_key (str) – Your PolySwarm API key.
testing (int) – Number of testing bounties to use.
insecure_transport (bool) – Allow insecure transport such as HTTP?
scanner (Scanner) – Scanner instance to use.
chains (set(str)) – Set of chains you are acting on.
artifact_types (list(ArtifactType)) – List of artifact types you support
- Returns
Microengine instantiated with a Client.
- Return type
-
classmethod
polyswarmclient.abstractscanner
¶
polyswarmclient.bloom
¶
Module Contents¶
-
polyswarmclient.bloom.
get_chunks_for_bloom
(value_hash)[source]¶ -
Bloom filter helper function. Turn a value hash into
-
a series of chunks.
- Parameters
value_hash (bytes) – Hash of to be encoded into the Bloom filter.
- Yields
chunk (bytes) – Chunks of the value hash.
-
polyswarmclient.bloom.
chunk_to_bloom_bits
(chunk)[source]¶ -
Bloom filter helper function. Turn a chunk into a series of
-
actual bytes.
- Parameters
chunk (bytes) – Byte encoded chunk.
-
polyswarmclient.bloom.
get_bloom_bits
(value)[source]¶ -
Bloom filter helper function. Get the Bloom bits of a
-
given value.
- Parameters
value (bytes) – Value to be encoded into the Bloom filter.
-
class
polyswarmclient.bloom.
BloomFilter
(value=0)[source]¶ Bases:
numbers.Number
-
add
(self, value)[source]¶ Add a single byte value to the Bloom filter.
- Parameters
value (bytes) – Byte encoded value to add to Bloom filter.
-
extend
(self, iterable)[source]¶ Add an iterable of byte values to the bloom filter.
- Parameters
iterable (Iterable[bytes]) – Iterable of byte values.
-
polyswarmclient.bountiesclient
¶
Module Contents¶
-
class
polyswarmclient.bountiesclient.
PostBountyTransaction
(client, artifact_type, amount, bounty_fee, artifact_uri, num_artifacts, duration, bloom)[source]¶
-
class
polyswarmclient.bountiesclient.
PostAssertionTransaction
(client, bounty_guid, bid, assertion_fee, mask, commitment)[source]¶
-
class
polyswarmclient.bountiesclient.
RevealAssertionTransaction
(client, bounty_guid, index, nonce, verdicts, metadata)[source]¶
-
class
polyswarmclient.bountiesclient.
PostVoteTransaction
(client, bounty_guid, votes, valid_bloom)[source]¶
polyswarmclient.config
¶
polyswarmclient.corpus
¶
polyswarmclient.events
¶
Module Contents¶
-
class
polyswarmclient.events.
Callback
[source]¶ Bases:
object
Abstract callback class which is the parent to a number of child callback classes to be used in different scenarios.
Note
Classes which extend Callback are expected to impliment the run method.
-
class
polyswarmclient.events.
OnRunCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called upon entering the event loop for the first time, use for initialization
-
class
polyswarmclient.events.
OnNewBlockCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called upon receiving a new block, scheduled events triggered separately
-
class
polyswarmclient.events.
OnNewBountyCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called upon receiving a new bounty
-
class
polyswarmclient.events.
OnNewAssertionCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called upon receiving a new assertion
-
class
polyswarmclient.events.
OnRevealAssertionCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called upon receiving a new assertion reveal
-
class
polyswarmclient.events.
OnNewVoteCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called upon receiving a new arbiter vote
-
class
polyswarmclient.events.
OnQuorumReachedCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called upon a bounty reaching quorum
-
class
polyswarmclient.events.
OnSettledBountyCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called upon a bounty being settled
-
class
polyswarmclient.events.
OnInitializedChannelCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called upon a channel being initialized
-
class
polyswarmclient.events.
Schedule
[source]¶ Bases:
object
Generic Schedule class. Uses a PriorityQueue data structure to store Events.
-
empty
(self)[source]¶ Return True if the queue is empty.
- Returns
Is the queue empty.
- Return type
boolean
-
peek
(self)[source]¶ Return True if the queue is empty.
- Returns
Tuple at the front of the queue if the queue is full, else None.
- Return type
(block, event)
-
-
class
polyswarmclient.events.
Event
(guid)[source]¶ Bases:
object
Generic Event class. Stores GUID and can compare for equality and order Events.
- Parameters
guid (str) – GUID of the event.
-
class
polyswarmclient.events.
RevealAssertion
(guid, index, nonce, verdicts, metadata)[source]¶ Bases:
polyswarmclient.events.Event
An assertion scheduled to be publically revealed
- Parameters
guid (str) – GUID of the bounty being asserted on
index (int) – Index of the assertion to reveal
nonce (str) – Secret nonce used to reveal assertion
verdicts (List[bool]) – List of verdicts for each artifact in the bounty
metadata (str) – Optional metadata
-
class
polyswarmclient.events.
OnRevealAssertionDueCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called when an assertion is needing to be revealed
-
class
polyswarmclient.events.
VoteOnBounty
(guid, votes, valid_bloom)[source]¶ Bases:
polyswarmclient.events.Event
A scheduled vote from an arbiter :param guid: GUID of the bounty being voted on :type guid: str :param votes: List of votes for each artifact in the bounty :type votes: List[bool] :param valid_bloom: Is the bloom filter submitted with the bounty valid :type valid_bloom: bool
-
class
polyswarmclient.events.
OnVoteOnBountyDueCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called when a bounty is needing to be voted on
-
class
polyswarmclient.events.
SettleBounty
(guid)[source]¶ Bases:
polyswarmclient.events.Event
A bounty scheduled to be settled :param guid: GUID of the bounty being asserted on :type guid: str
-
class
polyswarmclient.events.
OnSettleBountyDueCallback
[source]¶ Bases:
polyswarmclient.events.Callback
Called when a bounty is needing to be settled
polyswarmclient.log_formatter
¶
Module Contents¶
-
class
polyswarmclient.log_formatter.
ExtraTextFormatter
[source]¶ Bases:
logging.Formatter
Custom formatter that adds extra fields to the message string
-
format
(self, record)[source]¶ Takes a LogRecord and sets record.message = record.msg % record.args This one does some extra work. It searches the record dict for some extra keys we use in the client. (specified as extra= in the logger statement) If it finds one, it grabs the dict and adds an extra %s arg to record.msg, and the dict value to the record.args tuple.
-
-
class
polyswarmclient.log_formatter.
JSONFormatter
[source]¶ Bases:
pythonjsonlogger.jsonlogger.JsonFormatter
Class to add custom JSON fields to our logger. Presently just adds a timestamp if one isn’t present and the log level. INFO: https://github.com/madzak/python-json-logger#customizing-fields
polyswarmclient.relayclient
¶
polyswarmclient.stakingclient
¶
polyswarmclient.transaction
¶
Module Contents¶
-
polyswarmclient.transaction.
LOG_MSG_ENGINE_TOO_SLOW
= PLEASE REVIEW YOUR SCANNING LOGIC. Bounty inactive errors indicate that the microengine received the bounty, but was unable to respond to the bounty within the time window. Such errors are considered fatal during testing so you can easily identify them. If your engine is unable to respond within the time window on the live PolySwarm network, you risk losing the bid amount of the bounty at hand. We strongly encourage you to review your artifact scan process to identify areas where engine speed can be improved.[source]¶
-
class
polyswarmclient.transaction.
NonceManager
(client, chain)[source]¶ Manages the nonce for some Ethereum chain
-
class
polyswarmclient.transaction.
AbstractTransaction
(client, verifiers)[source]¶ Used to verify and post groups of transactions that make up a specific action.
For instance, when approving some funds to move, and calling a contract function that will consumer them.
-
has_required_event
(self, transaction_events)[source]¶ Checks for existence of events in transaction logs, ensuring successful completion
- Returns
True if the required event was in the list, false otherwise
-
polyswarmclient.utils
¶
Module Contents¶
-
polyswarmclient.utils.
asyncio_join
()[source]¶ -
Gather all remaining tasks, assumes loop is not running
polyswarmclient.verifiers
¶
Module Contents¶
-
class
polyswarmclient.verifiers.
DecodedTransaction
(to, value, data, abi, signature, parameters)[source]¶ This is a decoded representation of the transaction object returned by polyswarmd.
-
classmethod
from_transaction
(cls, transaction, abi)[source]¶ Parse a transaction from data returned from polyswarmd.
- Parameters
transaction (dict) – Transaction to be simplified
abi (str, list[str]) – ABI of the expected function call
- Returns
If valid, returns a SimplifiedTransaction
- Return type
- Raises
ValueError – If invalid transaction is provided
-
classmethod
-
class
polyswarmclient.verifiers.
AbstractTransactionVerifier
(parameters)[source]¶ Verifier is used to verify the details of a single transaction.
-
verify
(self, transaction)[source]¶ Called when a list of transactions were returned from polyswarmd. This function will verify the transactions, and determines if the transactions are expected.
- Parameters
transaction – Transaction representation returned from polyswarmd
- Returns
True if valid and expected
-
-
class
polyswarmclient.verifiers.
NctApproveVerifier
(amount)[source]¶ Bases:
polyswarmclient.verifiers.AbstractTransactionVerifier
-
class
polyswarmclient.verifiers.
NctTransferVerifier
(amount)[source]¶ Bases:
polyswarmclient.verifiers.AbstractTransactionVerifier
-
class
polyswarmclient.verifiers.
PostBountyVerifier
(artifact_type, amount, artifact_uri, num_artifacts, duration, bloom)[source]¶ Bases:
polyswarmclient.verifiers.AbstractTransactionVerifier
-
class
polyswarmclient.verifiers.
PostAssertionVerifier
(bounty_guid, bid, mask, commitment)[source]¶ Bases:
polyswarmclient.verifiers.AbstractTransactionVerifier
-
class
polyswarmclient.verifiers.
RevealAssertionVerifier
(bounty_guid, index, nonce, verdicts, metadata)[source]¶ Bases:
polyswarmclient.verifiers.AbstractTransactionVerifier
-
class
polyswarmclient.verifiers.
PostVoteVerifier
(bounty_guid, votes, valid_bloom)[source]¶ Bases:
polyswarmclient.verifiers.AbstractTransactionVerifier
-
class
polyswarmclient.verifiers.
SettleBountyVerifier
(bounty_guid)[source]¶ Bases:
polyswarmclient.verifiers.AbstractTransactionVerifier
-
class
polyswarmclient.verifiers.
StakingDepositVerifier
(amount)[source]¶ Bases:
polyswarmclient.verifiers.AbstractTransactionVerifier
Package Contents¶
-
class
polyswarmclient.
OffersClient
(client)[source]¶ Bases:
object
OffersClient to handle offers. Presently stores a given client and parameters.
-
class
polyswarmclient.
NonceManager
(client, chain)[source]¶ Manages the nonce for some Ethereum chain
-
all_finished
(self)¶ Check that all tasks have finished
-
mark_update_nonce
(self)¶ Call this when the nonce is out of sync. This sets the update flag to true. The next acquire after being set will trigger an update
-
-
polyswarmclient.
check_response
(response)[source]¶ -
Check the status of responses from polyswarmd
- Parameters
response – Response dict parsed from JSON from polyswarmd
- Returns
True if successful else False
- Return type
(bool)
-
polyswarmclient.
is_valid_ipfs_uri
(ipfs_uri)[source]¶ -
Ensure that a given ipfs_uri is valid by checking length and base58 encoding.
- Parameters
ipfs_uri (str) – ipfs_uri to validate
- Returns
is this valid?
- Return type
bool
-
class
polyswarmclient.
Client
(polyswarmd_addr, keyfile, password, api_key=None, tx_error_fatal=False, insecure_transport=False)[source]¶ Bases:
object
Client to connected to a Ethereum wallet as well as a polyswarmd instance.
- Parameters
polyswarmd_addr (str) – URI of polyswarmd you are referring to.
keyfile (str) – Keyfile filename.
password (str) – Password associated with keyfile.
api_key (str) – Your PolySwarm API key.
tx_error_fatal (bool) – Transaction errors are fatal and exit the program
insecure_transport (bool) – Allow insecure transport such as HTTP?
-
run
(self, chains=None)[source]¶ Run the main event loop
- Parameters
chains (set(str)) – Set of chains to operate on. Defaults to {‘home’, ‘side’}
-
sign_transactions
(self, transactions)[source]¶ Sign a set of transactions
- Parameters
transactions (List[Transaction]) – The transactions to sign
- Returns
The signed transactions
- Return type
List[Transaction]
ambassador
¶
Submodules¶
ambassador.__main__
¶
Module Contents¶
-
ambassador.__main__.
choose_backend
(backend)[source]¶ -
Resolves amabassador name string to implementation
- Parameters
backend (str) – Name of the backend to load, either one of the predefined implementations or the name of a module to load (module:ClassName syntax or default of module:Ambassador)
- Returns
Ambassador class of the selected implementation
- Return type
(Class)
- Raises
(Exception) – If backend is not found
-
ambassador.__main__.
main
(log, client_log, polyswarmd_addr, keyfile, password, api_key, backend, testing, insecure_transport, chains, watchdog, log_format, submission_rate)[source]¶ -
Entrypoint for the ambassador driver
- Parameters
log (str) – Logging level for all app logs
client_log (str) – Logging level for all polyswarmclient logs
polyswarmd_addr (str) – Address of polyswarmd
keyfile (str) – Path to private key file to use to sign transactions
password (str) – Password to decrypt the encrypted private key
backend (str) – Backend implementation to use
api_key (str) – API key to use with polyswarmd
testing (int) – Mode to process N bounties then exit (optional)
insecure_transport (bool) – Connect to polyswarmd without TLS
chains (List[str]) – Chain(s) to operate on
watchdog (int) – Number of blocks to look back and see if bounties are being submitted
log_format (str) – Format to output logs in. text or json
ambassador.eicar
¶
Module Contents¶
-
class
ambassador.eicar.
Ambassador
(client, testing=0, chains=None, watchdog=0, submission_rate=30)[source]¶ Bases:
polyswarmclient.abstractambassador.AbstractAmbassador
Ambassador which submits the EICAR test file
ambassador.filesystem
¶
Module Contents¶
-
class
ambassador.filesystem.
Ambassador
(client, testing=0, chains=None, watchdog=0, submission_rate=30)[source]¶ Bases:
polyswarmclient.abstractambassador.AbstractAmbassador
Ambassador which submits artifacts from a directory
microengine
¶
Submodules¶
microengine.__main__
¶
Module Contents¶
-
microengine.__main__.
choose_backend
(backend)[source]¶ -
Resolves microengine name string to implementation
- Parameters
backend (str) – Name of the backend to load, either one of the predefined implementations or the name of a module to load (module:ClassName syntax or default of module:Microengine)
- Returns
Microengine class of the selected implementation
- Return type
(Class)
- Raises
(Exception) – If backend is not found
-
microengine.__main__.
main
(log, client_log, polyswarmd_addr, keyfile, password, api_key, backend, testing, insecure_transport, chains, log_format, artifact_type)[source]¶ -
Entrypoint for the microengine driver
- Parameters
log (str) – Logging level for all app logs
client_log (str) – Logging level for all polyswarmclient logs
polyswarmd_addr (str) – Address of polyswarmd
keyfile (str) – Path to private key file to use to sign transactions
password (str) – Password to decrypt the encrypted private key
backend (str) – Backend implementation to use
api_key (str) – API key to use with polyswarmd
testing (int) – Mode to process N bounties then exit (optional)
insecure_transport (bool) – Connect to polyswarmd without TLS
chains (list[str]) – List of chains on which to scan artifacts
log_format (str) – Format to output logs in. text or json
artifact_type (list[str]) – List of artifact types to scan
microengine.clamav
¶
Module Contents¶
-
class
microengine.clamav.
Microengine
(client, testing=0, scanner=None, chains=None, artifact_types=None)[source]¶ Bases:
polyswarmclient.abstractmicroengine.AbstractMicroengine
Microengine which scans samples through clamd.
- Parameters
client (Client) – Client to use
testing (int) – How many test bounties to respond to
chains (set[str]) – Chain(s) to operate on
microengine.eicar
¶
Module Contents¶
-
class
microengine.eicar.
Microengine
(client, testing=0, scanner=None, chains=None, artifact_types=None)[source]¶ Bases:
polyswarmclient.abstractmicroengine.AbstractMicroengine
Microengine which tests for the EICAR test file.
- Parameters
client (Client) – Client to use
testing (int) – How many test bounties to respond to
chains (set[str]) – Chain(s) to operate on
microengine.multi
¶
microengine.producer
¶
Module Contents¶
-
class
microengine.producer.
Microengine
(client, testing=0, scanner=None, chains=None, artifact_types=None)[source]¶ Bases:
polyswarmclient.abstractmicroengine.AbstractMicroengine
microengine.scratch
¶
Module Contents¶
-
class
microengine.scratch.
Microengine
(client, testing=0, scanner=None, chains=None, artifact_types=None)[source]¶ Bases:
polyswarmclient.abstractmicroengine.AbstractMicroengine
Scratch microengine is the same as the default behavior.
- Parameters
client (Client) – Client to use
testing (int) – How many test bounties to respond to
chains (set[str]) – Chain(s) to operate on
microengine.yara
¶
arbiter
¶
Subpackages¶
arbiter.verbatimdb
¶
Submodules¶
Submodules¶
arbiter.__main__
¶
Module Contents¶
-
arbiter.__main__.
choose_backend
(backend)[source]¶ -
Resolves arbiter name string to implementation
- Parameters
backend (str) – Name of the backend to load, either one of the predefined implementations or the name of a module to load (module:ClassName syntax or default of module:Arbiter)
- Returns
Arbiter class of the selected implementation
- Return type
(Class)
- Raises
(Exception) – If backend is not found
-
arbiter.__main__.
main
(log, client_log, polyswarmd_addr, keyfile, password, api_key, backend, testing, insecure_transport, chains, log_format, artifact_type)[source]¶ -
Entrypoint for the arbiter driver
- Parameters
log (str) – Logging level for all app logs
client_log (str) – Logging level for all polyswarmclient logs
polyswarmd_addr (str) – Address of polyswarmd
keyfile (str) – Path to private key file to use to sign transactions
password (str) – Password to decrypt the encrypted private key
backend (str) – Backend implementation to use
api_key (str) – API key to use with polyswarmd
testing (int) – Mode to process N bounties then exit (optional)
insecure_transport (bool) – Connect to polyswarmd without TLS
chains (List[str]) – Chain(s) to operate on
log_format (str) – Format to output logs in. text or json
artifact_type (list[str]) – List of artifact types to scan
arbiter.clamav
¶
Module Contents¶
-
class
arbiter.clamav.
Arbiter
(client, testing=0, scanner=None, chains=None, artifact_types=None)[source]¶ Bases:
polyswarmclient.abstractarbiter.AbstractArbiter
Arbiter which scans samples through clamd.
Re-uses the scanner from the clamav microengine
- Parameters
client (Client) – Client to use
testing (int) – How many test bounties to respond to
chains (set[str]) – Chain(s) to operate on
arbiter.producer
¶
arbiter.verbatim
¶
Module Contents¶
-
class
arbiter.verbatim.
Arbiter
(client, testing=0, scanner=None, chains=None, artifact_types=None)[source]¶ Bases:
polyswarmclient.abstractarbiter.AbstractArbiter
Arbiter which matches hashes to a database of known samples
worker
¶
Submodules¶
worker.__main__
¶
Module Contents¶
-
worker.__main__.
choose_backend
(backend)[source]¶ -
Resolves scanner name string to implementation
- Parameters
backend (str) – Name of the backend to load, either one of the predefined implementations or the name of a module
load (to) –
(module – ClassName syntax or default of module:Scanner)
- Returns
Scanner class of the selected implementation
- Return type
(Class)
- Raises
(Exception) – If backend is not found
-
worker.__main__.
main
(log, client_log, redis_addr, queue, backend, tasks, download_limit, scan_limit, api_key, testing, log_format)[source]¶ -
Entrypoint for the worker driver
- Parameters
log (str) – Logging level for all app logs
client_log (str) – Logging level for all polyswarmclient logs
redis_addr (str) – Address of redis
backend (str) – Backend implementation to use
queue (str) – Name of queue to listen on
tasks (int) – Number of simultaneous tasks this worker runs
download_limit (int) – Number of simultaneous downloads this worker can handle
scan_limit (int) – Number of simultaneous scans this worker can handle
api_key (str) – API key to use with polyswarmd
testing (int) – Mode to process N bounties then exit (optional)
log_format (str) – Format to output logs in. text or json
Package Contents¶
- 1
Created with sphinx-autoapi
polyswarm-client
is a convenient library on which to build PolySwarm market participants.
Here you’ll find auto-generated documentation based on the polyswarm-client
source code.
Consulting these low level details is unnecessary for developing a successful PolySwarm participant. Most users will instead want to consult the PolySwarm Documentation.
Developers interested in low level polyswarm-client
details can do so by navigating to “API Reference” on the left.