68 lines
1.8 KiB
Python
68 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Check if GraphQL has viewing/pickup data"""
|
|
import asyncio
|
|
import json
|
|
import sys
|
|
sys.path.insert(0, 'src')
|
|
|
|
from graphql_client import GRAPHQL_ENDPOINT
|
|
import aiohttp
|
|
|
|
# Expanded query to check for all available fields
|
|
EXTENDED_QUERY = """
|
|
query LotBiddingData($lotDisplayId: String!, $locale: String!, $platform: Platform!) {
|
|
lotDetails(displayId: $lotDisplayId, locale: $locale, platform: $platform) {
|
|
lot {
|
|
id
|
|
displayId
|
|
auctionId
|
|
currentBidAmount { cents currency }
|
|
initialAmount { cents currency }
|
|
nextMinimalBid { cents currency }
|
|
bidsCount
|
|
startDate
|
|
endDate
|
|
|
|
# Try to find viewing/pickup fields
|
|
viewingDays { startDate endDate city countryCode }
|
|
collectionDays { startDate endDate city countryCode }
|
|
pickupDays { startDate endDate city countryCode }
|
|
}
|
|
auction {
|
|
id
|
|
displayId
|
|
viewingDays { startDate endDate city countryCode }
|
|
collectionDays { startDate endDate city countryCode }
|
|
}
|
|
}
|
|
}
|
|
"""
|
|
|
|
async def main():
|
|
variables = {
|
|
"lotDisplayId": "A1-28505-5",
|
|
"locale": "nl",
|
|
"platform": "TWK"
|
|
}
|
|
|
|
payload = {
|
|
"query": EXTENDED_QUERY,
|
|
"variables": variables
|
|
}
|
|
|
|
try:
|
|
async with aiohttp.ClientSession() as session:
|
|
async with session.post(GRAPHQL_ENDPOINT, json=payload, timeout=30) as response:
|
|
if response.status == 200:
|
|
data = await response.json()
|
|
print("Full GraphQL Response:")
|
|
print(json.dumps(data, indent=2))
|
|
else:
|
|
print(f"Error: {response.status}")
|
|
print(await response.text())
|
|
except Exception as e:
|
|
print(f"Exception: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|