scenario 1: i gave cursor a link to a simple get request example and it couldn’t even reproduce the code, i presume it hallucinated
scenario 1 code:
import requests
def get_token_data(token_address):
url = f"https://api.dexscreener.com/latest/dex/tokens/{token_address}"
response = requests.get(url)
return response.json()
token_address = input("Enter token address: ")
data = get_token_data(token_address)
print(data)
scenario 2: i screenshotted the example and showed it to gpt4 vision and correctly reproduced it.
scenario 2 code:
import requests
BASE_URL = "https://api.dexscreener.com/latest/dex/tokens"
def get_token_data(addresses):
# Construct the full URL
url = f"{BASE_URL}/{addresses}"
# Make the request
response = requests.get(url)
# Check if the request was successful
if response.status_code == 200:
return response.json()
else:
return f"Error: {response.status_code}"
if __name__ == "__main__":
# Example usage
addresses = input("Enter the token addresses (comma-separated, up to 30): ")
data = get_token_data(addresses)
print(data)
what am i missing? thank you