> For the complete documentation index, see [llms.txt](https://docs.bv7x.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bv7x.ai/use-the-signal/examples/python.md).

# Python

Complete example: sign a message, verify your wallet, and fetch the oracle signal.

***

## Requirements

```bash
pip install web3 requests
```

***

## Full Example

```python
from web3 import Web3
from eth_account.messages import encode_defunct
import requests
import time

# Configuration
WALLET = "0xYourWalletAddress"
PRIVATE_KEY = "0xYourPrivateKey"  # never commit this
BASE_URL = "https://bv7x.ai"

# Step 1: Sign verification message
timestamp = int(time.time())
message = f"Verify BV7X balance: {WALLET}:{timestamp}"
w3 = Web3()
signed = w3.eth.account.sign_message(
    encode_defunct(text=message), private_key=PRIVATE_KEY
)

# Step 2: Verify wallet and get bearer token
verify_resp = requests.post(f"{BASE_URL}/api/bv7x/oracle/verify", json={
    "wallet": WALLET,
    "signature": signed.signature.hex(),
    "timestamp": timestamp,
})
verify_data = verify_resp.json()
print(f"Tier: {verify_data['tier']}, Balance: {verify_data['balance']}")
token = verify_data["token"]

# Step 3: Fetch the oracle signal
headers = {"Authorization": f"Bearer {token}"}
signal = requests.get(f"{BASE_URL}/api/bv7x/oracle", headers=headers).json()
print(f"Signal: {signal['signal']}")
print(f"Direction: {signal['direction']}")
print(f"Confidence: {signal['confidence']}")
print(f"Regime: {signal['regime']}")
print(f"BTC: ${signal['btcPrice']:,}")
```

***

## Output

```
Tier: basic, Balance: 750000000
Signal: SELL
Direction: DOWN
Confidence: 0.615
Regime: BEAR_TREND
BTC: $66,027
```

***

## Notes

* The `PRIVATE_KEY` is used only to sign the verification message. It is never sent to the server.
* The bearer token expires after 30 minutes. Call the verify flow again to renew.
* For Premium tier endpoints, your wallet must hold 1B+ $BV7X.

***

## Next

* [Node.js Example](/use-the-signal/examples/nodejs.md) -- same flow in JavaScript
* [cURL Examples](/use-the-signal/examples/curl.md) -- quick command reference
