enrich data
This commit is contained in:
93
explore_auction_schema.py
Normal file
93
explore_auction_schema.py
Normal file
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Explore the actual auction schema"""
|
||||
import asyncio
|
||||
import aiohttp
|
||||
import json
|
||||
|
||||
GRAPHQL_ENDPOINT = "https://storefront.tbauctions.com/storefront/graphql"
|
||||
|
||||
# Try different field structures
|
||||
QUERIES = {
|
||||
"viewingDays_simple": """
|
||||
query AuctionData($auctionId: TbaUuid!, $locale: String!, $platform: Platform!) {
|
||||
auction(id: $auctionId, locale: $locale, platform: $platform) {
|
||||
viewingDays {
|
||||
city
|
||||
countryCode
|
||||
}
|
||||
}
|
||||
}
|
||||
""",
|
||||
"viewingDays_with_times": """
|
||||
query AuctionData($auctionId: TbaUuid!, $locale: String!, $platform: Platform!) {
|
||||
auction(id: $auctionId, locale: $locale, platform: $platform) {
|
||||
viewingDays {
|
||||
from
|
||||
to
|
||||
city
|
||||
}
|
||||
}
|
||||
}
|
||||
""",
|
||||
"full_auction": """
|
||||
query AuctionData($auctionId: TbaUuid!, $locale: String!, $platform: Platform!) {
|
||||
auction(id: $auctionId, locale: $locale, platform: $platform) {
|
||||
id
|
||||
displayId
|
||||
biddingStatus
|
||||
buyersPremium
|
||||
viewingDays {
|
||||
city
|
||||
countryCode
|
||||
from
|
||||
to
|
||||
}
|
||||
collectionDays {
|
||||
city
|
||||
countryCode
|
||||
from
|
||||
to
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
async def test_query(name, query, auction_id):
|
||||
variables = {
|
||||
"auctionId": auction_id,
|
||||
"locale": "nl",
|
||||
"platform": "TWK"
|
||||
}
|
||||
|
||||
payload = {
|
||||
"query": query,
|
||||
"variables": variables
|
||||
}
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.post(GRAPHQL_ENDPOINT, json=payload, timeout=30) as response:
|
||||
data = await response.json()
|
||||
|
||||
print(f"\n{'='*60}")
|
||||
print(f"QUERY: {name}")
|
||||
print(f"{'='*60}")
|
||||
|
||||
if 'errors' in data:
|
||||
print("ERRORS:")
|
||||
for error in data['errors']:
|
||||
print(f" {error}")
|
||||
else:
|
||||
print("SUCCESS:")
|
||||
print(json.dumps(data, indent=2))
|
||||
|
||||
async def main():
|
||||
# Test with the auction we know exists
|
||||
auction_id = "9d5d9d6b-94de-4147-b523-dfa512d85dfa"
|
||||
|
||||
for name, query in QUERIES.items():
|
||||
await test_query(name, query, auction_id)
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user