title: requests - Gateway Timeout
body: <p>this is a test script to request data from <code>Rovi API</code>, provided by the <code>API</code> itself.</p>
  
  <p><strong>test.py</strong></p>
  
  <pre><code>import requests 
  import time
  import hashlib
  import urllib
  
  class AllMusicGuide(object):
      api_url = 'http://api.rovicorp.com/data/v1.1/descriptor/musicmoods'
  
      key = 'my key'
      secret = 'secret'
  
      def _sig(self):
          timestamp = int(time.time())
  
          m = hashlib.md5()
          m.update(self.key)
          m.update(self.secret)
          m.update(str(timestamp))
  
          return m.hexdigest()
  
      def get(self, resource, params=None):
          """Take a dict of params, and return what we get from the api"""
  
          if not params:
              params = {}
  
          params = urllib.urlencode(params)
  
          sig = self._sig()
  
          url = "%s/%s?apikey=%s&amp;sig=%s&amp;%s" % (self.api_url, resource, self.key, sig, params)
  
          resp = requests.get(url)
  
          if resp.status_code != 200:         
              # THROW APPROPRIATE ERROR
                  print ('unknown err')
  
          return resp.content
  </code></pre>
  
  <p>from another <code>script</code> I import the <code>module</code>:</p>
  
  <pre><code>from roviclient.test import AllMusicGuide
  </code></pre>
  
  <p>and create an instance of the <code>class</code> inside a <code>mood function</code>:</p>
  
  <pre><code>def mood():
      test = AllMusicGuide()
      print (test.get('[moodids=moodids]'))
  </code></pre>
  
  <p>according to <a href="http://developer.rovicorp.com/docs" rel="nofollow">documentation</a>, the following is the <code>syntax</code> for requests:</p>
  
  <pre><code>descriptor/musicmoods?apikey=apikey&amp;sig=sig [&amp;moodids=moodids] [&amp;format=format] [&amp;country=country] [&amp;language=language]
  </code></pre>
  
  <p>but running the script I get the following error:</p>
  
  <p><code>unknown err
  &lt;h1&gt;Gateway Timeout&lt;/h1&gt;:</code></p>
  
  <p>what is wrong?</p>