Help with POE 2 Trading site fetching Item IDs

Hello,

I wanted to find out the most expensive unique items using python.
I keep getting an error saying it has fetched 0 items.
Can anyone help me with the code?

https://www.pathofexile.com/trade2/search/poe2/Standard/K7XZq0MT5

***
import requests

# Constants
LEAGUE = "Standard"
SEARCH_ID = "K7XZq0MT5"
SEARCH_URL = f"https://www.pathofexile.com/api/trade2/search/{LEAGUE}/{SEARCH_ID}"
HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.5938.132 Safari/537.36",
"Content-Type": "application/json"
}

# Step 1: Fetch item IDs
response = requests.get(SEARCH_URL, headers=HEADERS)
if response.status_code == 200:
search_results = response.json()
print("Search Results Debug:", search_results) # Debug the entire response
item_ids = search_results.get("result", [])[:50]
print(f"Retrieved {len(item_ids)} item IDs.")
else:
print(f"Failed to fetch item IDs. Status Code: {response.status_code}")
print("Response Content:", response.text)
exit()

if not item_ids:
print("No items found for the query. Exiting.")
exit()
***
Last edited by Gomuchicken#4754 on Dec 21, 2024, 3:07:56 AM
Last bumped on Dec 21, 2024, 3:05:36 AM

Report Forum Post

Report Account:

Report Type

Additional Info