60 lines
1.3 KiB
Python
60 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Test if the auction query works at all"""
|
|
import asyncio
|
|
import aiohttp
|
|
import json
|
|
|
|
GRAPHQL_ENDPOINT = "https://storefront.tbauctions.com/storefront/graphql"
|
|
|
|
# Try a simpler query first
|
|
SIMPLE_QUERY = """
|
|
query AuctionData($auctionId: TbaUuid!, $locale: String!, $platform: Platform!) {
|
|
auction(id: $auctionId, locale: $locale, platform: $platform) {
|
|
id
|
|
displayId
|
|
viewingDays {
|
|
startDate
|
|
endDate
|
|
city
|
|
countryCode
|
|
}
|
|
collectionDays {
|
|
startDate
|
|
endDate
|
|
city
|
|
countryCode
|
|
}
|
|
}
|
|
}
|
|
"""
|
|
|
|
async def main():
|
|
auction_id = "9d5d9d6b-94de-4147-b523-dfa512d85dfa"
|
|
|
|
variables = {
|
|
"auctionId": auction_id,
|
|
"locale": "nl",
|
|
"platform": "TWK"
|
|
}
|
|
|
|
payload = {
|
|
"query": SIMPLE_QUERY,
|
|
"variables": variables
|
|
}
|
|
|
|
async with aiohttp.ClientSession() as session:
|
|
async with session.post(GRAPHQL_ENDPOINT, json=payload, timeout=30) as response:
|
|
print(f"Status: {response.status}")
|
|
text = await response.text()
|
|
print(f"Response: {text}")
|
|
|
|
try:
|
|
data = await response.json()
|
|
print(f"\nParsed:")
|
|
print(json.dumps(data, indent=2))
|
|
except:
|
|
pass
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|