title: How would I use the GIPHY Python API with my discord bot?
body: <p>From my understanding I can use this example from the GIPHY docs (<a href="https://gyazo.com/1b6c0094162a54fe49029f665badf8df" rel="nofollow noreferrer">https://gyazo.com/1b6c0094162a54fe49029f665badf8df</a>) to open a url but I don't understand it too much. To add onto that, when I run this code I get the error: </p>
  
  <p>discord.ext.commands.errors.CommandInvokeError: Command raised an exception: 
  AttributeError: module 'urllib' has no attribute 'urlopen'</p>
  
  <p>My question is how can I randomly import a GIF from certain tags once the user types #giphy in a text channel </p>
  
  <p>Here is my current code: (Code got updated)</p>
  
  <pre><code>@bot.command(pass_context = True)
  @commands.cooldown(1, 3, commands.BucketType.user)
  async def gif(ctx, *, search):
  channel = ctx.message.channel
  session = aiohttp.ClientSession()
  
  msg = await bot.send_message(channel, "**searching for " + search + "..**")
  randomMessage = await bot.send_message(channel, "**showing a random image due to no images found from your search or you just didn't search anything**")
  
  if search == "":
      randomImage = True
      print("random")
      randomMessage
      response = await session.get("https://api.giphy.com/v1/gif/random?api_keyY=4hnrG09EqYcNnv63Sj2gJvmy9ilDPx5&amp;limit=10")
  else:
      msg
      print("searching")
      correct_search = search.replace(" ", "+")
      reponse = await session.get("http://api.giphy.com/v1/gifs/search?q=" + correct_search + "&amp;api_key=Y4hnrG09EqYcNnv63Sj2gJvmy9ilDPx5&amp;limit=10")
  data = json.loads(await reponse.text())
  await session.close()
  
  embed = discord.Embed(
      description = '**showing result for ' + search + '**',
      colour = discord.Colour.blue()
  )
  
  gif_choice = random.randint(0,9)
  embed.set_image(url=data["data"][gif_choice]["images"]["original"]["url"])
  if randomImage:
      await bot.delete_message(randomMessage)
  else:
      await bot.delete_message(msg)
  
  await bot.send_message(channel, embed=embed)
  </code></pre>
  
  <p>Thank you</p>