generated from nathanwoodburn/firewallet-plugin-template
feat: Initial search function
This commit is contained in:
@@ -95,7 +95,6 @@ This isn't done yet but use it over text as it includes parsing
|
|||||||
### Plain Text
|
### Plain Text
|
||||||
Type: `text`
|
Type: `text`
|
||||||
|
|
||||||
|
|
||||||
### List
|
### List
|
||||||
Type: `list`
|
Type: `list`
|
||||||
This is a list if text items (or HTML items)
|
This is a list if text items (or HTML items)
|
||||||
|
|||||||
BIN
__pycache__/account.cpython-313.pyc
Normal file
BIN
__pycache__/account.cpython-313.pyc
Normal file
Binary file not shown.
0
account.py
Normal file
0
account.py
Normal file
@@ -48,13 +48,33 @@ def domain_info(params, authentication):
|
|||||||
if not domain:
|
if not domain:
|
||||||
return {"info": "No domain provided"}
|
return {"info": "No domain provided"}
|
||||||
|
|
||||||
response = requests.post(f"https://shakestation.com/api",
|
response = requests.post(f"https://shakestation.io/api",
|
||||||
json={"action":"getTLD","tld":domain})
|
data={"action":"getTLD","tld":domain})
|
||||||
|
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
return {"info": "Failed to fetch data from Shakestation"}
|
return {"info": "Failed to fetch data from Shakestation"}
|
||||||
data = response.json()
|
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"}
|
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))
|
||||||
Reference in New Issue
Block a user