File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed
Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ def get_card_number(card):
2222 return None
2323
2424def pull_product_information ():
25- # Get products
2625 url = f"https://tcgcsv.com/tcgplayer/3/{ SET_PRODUCT_MATCHING ['sv01' ]} /products"
2726 r = requests .get (url )
2827
@@ -31,36 +30,31 @@ def pull_product_information():
3130
3231 data = r .json ()
3332
34- # Get prices ONCE
3533 url_prices = f"https://tcgcsv.com/tcgplayer/3/22873/prices"
3634 r_prices = requests .get (url_prices )
3735 price_data = r_prices .json ()
3836
39- # Create price lookup dictionary
4037 price_dict = {price ["productId" ]: price ["marketPrice" ]
4138 for price in price_data ["results" ]}
4239
43- # Build lists
4440 product_id_list = []
4541 name_list = []
4642 card_number_list = []
4743 price_list = []
4844
49- for card in data ["results" ]: # Remove islice to get all cards
45+ for card in data ["results" ]:
5046 if not is_card (card ):
5147 continue
5248
5349 number = get_card_number (card )
5450 card_number_list .append (number )
5551
56- # Clean name
5752 name = card ["name" ].partition ("-" )[0 ].strip () if "-" in card ["name" ] else card ["name" ]
5853 name_list .append (name )
5954
6055 product_id = card ["productId" ]
6156 product_id_list .append (product_id )
6257
63- # Look up price from dictionary (fast!)
6458 market_price = price_dict .get (product_id )
6559 price_list .append (market_price )
6660
You can’t perform that action at this time.
0 commit comments