Python Example

See our full reference implementation here.

Note: This page assumes you are using MacOS or Linux. See the reference implementation for Windows instructions.

Step 1: Create a virtual environment

python3 -m venv venv
source venv/bin/activate

# Add Buf registry to virtual environment
printf "
[global]
extra-index-url = https://buf.build/gen/python
" > venv/pip.conf

Step 2: Add required dependencies

pip install fxnlabs-api-gateway-community-danielgtaylor-betterproto
pip install grpclib

Step 3: Create the API Client

api_key = 'MY_FXN_API_KEY'

channel = Channel('api.fxnrouter.com')
client = APIGatewayServiceStub(channel, metadata=[('authorization', f'Bearer {api_key}')])

Step 4: Make an API call