diff --git a/README.md b/README.md index 86f079d..d513d05 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,6 @@ This isn't done yet but use it over text as it includes parsing ### Plain Text Type: `text` - ### List Type: `list` This is a list if text items (or HTML items) diff --git a/__pycache__/account.cpython-313.pyc b/__pycache__/account.cpython-313.pyc new file mode 100644 index 0000000..8c58c0d Binary files /dev/null and b/__pycache__/account.cpython-313.pyc differ diff --git a/account.py b/account.py new file mode 100644 index 0000000..e69de29 diff --git a/shakestation.py b/shakestation.py index 346524b..479d082 100644 --- a/shakestation.py +++ b/shakestation.py @@ -48,13 +48,33 @@ def domain_info(params, authentication): if not domain: return {"info": "No domain provided"} - response = requests.post(f"https://shakestation.com/api", - json={"action":"getTLD","tld":domain}) + 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() - return {"info": data} + + # 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"] + if domainType == "marketplace": + score = data["data"].get("score", "No score available") + price = data["data"].get("price", "No price available") + return {"info": f"Domain is listed on Shakestation with score {score} and price {price}"} + + - return {"info": "TODO"} \ No newline at end of file + return {"info": f"TODO: {domainType} domain type not implemented yet. Data: {data}"} + +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)) \ No newline at end of file