GraphQL integrate, data correctness
This commit is contained in:
32
test_graphql_scraper.py
Normal file
32
test_graphql_scraper.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Test the updated scraper with GraphQL integration"""
|
||||
import asyncio
|
||||
import sys
|
||||
sys.path.insert(0, 'src')
|
||||
|
||||
from graphql_client import fetch_lot_bidding_data, format_bid_data
|
||||
|
||||
async def main():
|
||||
# Test with known lot ID
|
||||
lot_id = "A1-28505-5"
|
||||
|
||||
print(f"Testing GraphQL API with lot: {lot_id}\n")
|
||||
|
||||
bidding_data = await fetch_lot_bidding_data(lot_id)
|
||||
|
||||
if bidding_data:
|
||||
print("Raw GraphQL Response:")
|
||||
print("="*60)
|
||||
import json
|
||||
print(json.dumps(bidding_data, indent=2))
|
||||
|
||||
print("\n\nFormatted Data:")
|
||||
print("="*60)
|
||||
formatted = format_bid_data(bidding_data)
|
||||
for key, value in formatted.items():
|
||||
print(f" {key}: {value}")
|
||||
else:
|
||||
print("Failed to fetch bidding data")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user