So this is a simple Auction Flipper I was programming a ChatTrigger that uses the players api to send auction instantly ingame instead of a terminal if anyone has a clue or any idea what i can fix up in my code feel free to help my discord is A991023882#6608
import asyncio
import re
import os
op = os.name == 'nt'
if op: import winsound
from concurrent.futures import ThreadPoolExecutor
from timeit import default_timer
import time
import pandas as pd
import requests
from plyer import notification
# Your player API key
PLAYER_API_KEY = "API KEY GOES HERE"
c = requests.get("https://api.hypixel.net/skyblock/auctions?page=0")
resp = c.json()
now = resp['lastUpdated']
toppage = resp['totalPages']
results = []
prices = {}
# stuff to remove
REFORGES = [" ✦", "⚚ ", " ✪", "✪", "Stiff ", "Lucky ", "Jerry's ", "Dirty ", "Fabled ", "Suspicious ", "Gilded ", "Warped ", "Withered ", "Bulky ", "Stellar ", "Heated ", "Ambered ", "Fruitful ", "Magnetic ", "Fleet ", "Mithraic ", "Auspicious ", "Refined ", "Headstrong ", "Precise ", "Spiritual ", "Moil ", "Blessed ", "Toil ", "Bountiful ", "Candied ", "Submerged ", "Reinforced ", "Cubic ", "Warped ", "Undead ", "Ridiculous ", "Necrotic ", "Spiked ", "Jaded ", "Loving ", "Perfect ", "Renowned ", "Giant ", "Empowered ", "Ancient ", "Sweet ", "Silky ", "Bloody ", "Shaded ", "Gentle ", "Odd ", "Fast ", "Fair ", "Epic ", "Sharp ", "Heroic ", "Spicy ", "Legendary ", "Deadly ", "Fine ", "Grand ", "Hasty ", "Neat ", "Rapid ", "Unreal ", "Awkward ", "Rich ", "Clean ", "Fierce ", "Heavy ", "Light ", "Mythic ", "Pure ", "Smart ", "Titanic ", "Wise ", "Bizarre ", "Itchy ", "Ominous ", "Pleasant ", "Pretty ", "Shiny ", "Simple ", "Strange ", "Vivid ", "Godly ", "Demonic ", "Forceful ", "Hurtful ", "Keen ", "Strong ", "Superior ", "Unpleasant ", "Zealous "]
# Constant for the lowest priced item you want to be shown to you; feel free to change this
LOWEST_PRICE = 500000
# Constant to turn on/off desktop notifications
NOTIFY = False
# Constant for the lowest percent difference you want to be shown to you; feel free to change this
LOWEST_PERCENT_MARGIN = 1/2
START_TIME = default_timer()
def fetch(session, page):
global toppage
base_url = "https://api.hypixel.net/skyblock/auctions?page="
with session.get(base_url + page) as response:
# puts response in a dict
data = response.json()
toppage = data['totalPages']
if data['success']:
toppage = data['totalPages']
for auction in data['auctions']:
if not auction['claimed'] and auction['bin'] == True and not "Furniture" in auction["item_lore"]: # if the auction isn't a) claimed and is b) BIN
# removes level if it's a pet, also
# ...
# Rest of your code here
# ...
pass
async def main():
with ThreadPoolExecutor(max_workers=10) as executor:
with requests.Session() as session:
loop = asyncio.get_event_loop()
tasks = [
loop.run_in_executor(
executor,
fetch,
*(session, str(page))
)
for page in range(0, toppage)
]
for response in await asyncio.gather(*tasks):
pass
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
END_TIME = default_timer()
print("Time elapsed: ", END_TIME - START_TIME)
input("Press any key to exit...")