I try use requests library to make request. Using Python 3.10 Replit
import requests
import json
async def check365(interaction: discord.Interaction):
await interaction.response.defer(ephemeral=False)
# data = message
r = requests.get(
'https://domain.com/ajax/api?user=a&pass=b'
)
#Res is: [{'username': 'a', 'password': 'b', 'status': 'valid'}]
res = json.loads(r.text)
mess = ''
if res[0]['status'] == 'valid':
mess = 'ok'
else:
mess = 'fail'
await interaction.followup.send("Message: " + " --> " + mess)
but i have a error:
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Some post say change: https to http, i had try but not work…
I had try on Visual Studio, and this code work. When i push to replit and that not work… Anyone can help me…