mirror of
https://github.com/bisq-network/bisq-api-reference.git
synced 2026-01-27 17:43:33 +00:00
This might give Python devs an easier time than if all the sample code lived deep inside a gradle project. This means there is no root project gradle build file; the reference-doc-builder and java-examples modules are separate java projects, with their own build files.
28 lines
952 B
Python
28 lines
952 B
Python
from builtins import print
|
|
|
|
import grpc
|
|
|
|
# from getpass import getpass
|
|
import bisq.api.grpc_pb2 as bisq_messages
|
|
import bisq.api.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.GetCryptoCurrencyPaymentMethods.with_call(
|
|
bisq_messages.GetCryptoCurrencyPaymentMethodsRequest(),
|
|
metadata=[('password', api_password)])
|
|
payment_methods = list(response[0].payment_methods)
|
|
print('Response contains {0} payment methods: '.format(len(payment_methods)))
|
|
for payment_method in payment_methods:
|
|
print('\t{0}'.format(payment_method.id))
|
|
except grpc.RpcError as rpc_error:
|
|
print('gRPC API Exception: %s', rpc_error)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|