import json import requests # Plugin Data info = { "name": "Shakestation", "description": "Connect to Shakestation", "version": "1.0", "author": "Nathan.Woodburn/" } # Functions functions = { "main":{ "name": "Function name", "type": "default", "description": "Description", "params": {}, "returns": { "status": { "name": "Status of the function", "type": "text" } } }, "domain_info": { "name": "Domain info", "type": "search", "description": "Check if Shakestation has information on a domain", "params": {}, "returns": { "info": { "name": "Shakestation information", "type": "text" } } } } def main(params, authentication): return {"status": "Success"} def checkStaked(domain): """ Check if a domain is staked on Shakestation. """ response = requests.post(f"https://shakestation.io/api", data={"action":"getStakedTLD","tld":domain}) if response.status_code != 200: return False data = response.json() # Check if the domain is staked if "data" not in data: return False return data["data"] return False def domain_info(params, authentication): domain = params.get("domain") if not domain: return {"info": "No domain provided"} response = requests.post(f"https://shakestation.io/api", data={"action":"getTLD","tld":domain}) if response.status_code != 200: return {"info": "Failed to fetch data from Shakestation"} data = response.json() # Parse info if "data" not in data: return {"info": "No data found for the provided domain"} if "type" not in data["data"]: return {"info": "No type found in the data"} domainType = data["data"]["type"] score = data["data"].get("score", "No score available") returnInfo = f"

Score: {score}

" if domainType == "marketplace": price = data["data"].get("price", "No price available") returnInfo = f"

Score: {score}
Price: {price}

View Listing" else: stakedData = checkStaked(domain) if stakedData: returnInfo += f"

Staked: {stakedData.get('price', '-1')} HNS ({stakedData.get('renew_price','-1')} HNS/yr)

View Listing" return {"info": returnInfo} if __name__ == "__main__": # Example usage params = {"domain": "pinwheelgalaxy"} authentication = None # Replace with actual authentication if needed result = domain_info(params, authentication) print(json.dumps(result, indent=2)) params = {"domain": "denizen"} result = domain_info(params, authentication) print(json.dumps(result, indent=2))