mirror of
https://github.com/bisq-network/bisq-api-reference.git
synced 2026-01-27 17:43:33 +00:00
- Use requirements.txt to install dependencies to local venv. - Use setup.py to build/install example packages to local venv. - Adjust reference-doc-builder to new Python pkg imports.
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
from builtins import print
|
|
|
|
import grpc
|
|
|
|
# from getpass import getpass
|
|
import python_examples.bisqapi.grpc_pb2 as bisq_messages
|
|
import python_examples.bisqapi.grpc_pb2_grpc as bisq_service
|
|
|
|
|
|
def main():
|
|
grpc_channel = grpc.insecure_channel('localhost:9998')
|
|
grpc_service_stub = bisq_service.PaymentAccountsStub(grpc_channel)
|
|
api_password: str = 'xyz' # getpass("Enter API password: ")
|
|
try:
|
|
response = grpc_service_stub.CreateCryptoCurrencyPaymentAccount.with_call(
|
|
bisq_messages.CreateCryptoCurrencyPaymentAccountRequest(
|
|
account_name='name',
|
|
currency_code='XMR',
|
|
address='472CJ9TADoeVabhAe6byZQN4yqAFA4morKiyzb8DfLTj4hcQvsXNHxJUNYMw1JDmMALkQ3Bwmyn4aZYST7DzEw9nUeUTKVL',
|
|
trade_instant=False),
|
|
metadata=[('password', api_password)])
|
|
print('Response: ' + str(response[0].payment_account))
|
|
except grpc.RpcError as rpc_error:
|
|
print('gRPC API Exception: %s', rpc_error)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|