I have the code
python @bot.command(pass_context=True,brief='Checks if a user has a valid Minecraft Username just input the username') @commands.has_role("SuperAdmin") async def verify(ctx, *, username): """validates a users MC account actually exists""" url = f'https://api.mojang.com/users/profiles/minecraft/{username}?' javacheck = requests.get(url) status = javacheck.status_code if status != 204: uuid = javacheck.json()['id'] await ctx.send(f'{username} checks out as a *Java* player') if status == 204: try: gt = xbox.GamerProfile.from_gamertag(username) await ctx.send(f'{username} checks out as a *Bedrock* player') except xbox.exceptions.GamertagNotFound: await ctx.send(f'{username} is not a valid minecraft account on any platform')
and I get the error: Command raised an exception: JSONDecodeError: Expecting value: line 1 column 1 (char 0)
randomly when i am using my code, but restarting the application fixes the error. The code works most of the time, but after a while if it needs to call the Xbox Live API it just doesn't work.
I have the code
python @bot.command(pass_context=True,brief='Checks if a user has a valid Minecraft Username just input the username') @commands.has_role("SuperAdmin") async def verify(ctx, *, username): """validates a users MC account actually exists""" url = f'https://api.mojang.com/users/profiles/minecraft/{username}?' javacheck = requests.get(url) status = javacheck.status_code if status != 204: uuid = javacheck.json()['id'] await ctx.send(f'{username} checks out as a *Java* player') if status == 204: try: gt = xbox.GamerProfile.from_gamertag(username) await ctx.send(f'{username} checks out as a *Bedrock* player') except xbox.exceptions.GamertagNotFound: await ctx.send(f'{username} is not a valid minecraft account on any platform')
and I get the error: Command raised an exception: JSONDecodeError: Expecting value: line 1 column 1 (char 0) randomly when i am using my code, but restarting the application fixes the error. The code works most of the time, but after a while if it needs to call the Xbox Live API it just doesn't work.