title: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'rank'
body: <p>i'am trying to make an Hypixel API command, but i get an error if the person doesn't have an rank.
  My code:</p>
  <pre class="lang-py prettyprint-override"><code>import requests
  
  @commands.command() 
      async def api(self, ctx):
          user = ctx.message.content[5:]
          key = &quot;#############&quot;
          r2 = requests.get(f&quot;https://api.mojang.com/users/profiles/minecraft/{user}&quot;)
          uuid = r2.json()
          r = requests.get(f&quot;https://api.hypixel.net/player?key={key}&amp;uuid={uuid['id']}&quot;)
          d = r.json()
  
          e = discord.Embed(color=0xff7373)
          e.set_author(name=f&quot;{uuid['name']}'s Hypixel Stats:&quot;)
          e.set_thumbnail(url=f&quot;https://mc-heads.net/avatar/{uuid['id']}.png&quot;)
          e.add_field(name=&quot;Rank:&quot;, value=d['player']['rank'].capitalize())
          e.add_field(name=&quot;Bedwars Wins:&quot;, value=d['player']['achievements']['bedwars_wins'])
          e.set_footer(text=f&quot;UUID: {uuid['id']}&quot;)
  
          await ctx.send(embed=e)
  </code></pre>