elon_py/poly/main.py

26 lines
647 B
Python
Raw Permalink Normal View History

2025-05-23 16:39:38 +08:00
import requests
import json
# API endpoint
url = "https://gamma-api.polymarket.com/markets"
# Parameters
params = {
"clob_token_ids": "867120030737778362406620246392661182987264708958188075536191457143522877699"
}
# Make the GET request
try:
response = requests.get(url, params=params)
response.raise_for_status() # Raise an error for bad status codes
# Parse JSON response
market_data = response.json()
# Pretty-print the JSON data
print("Market Data:")
print(json.dumps(market_data, indent=4, sort_keys=True))
except requests.exceptions.RequestException as e:
print(f"Error fetching market data: {e}")