title: Search Bing via Azure API using Python
body: <p>How can I search Bing for images using key words?</p>
  
  <p>I am able to search Google using:</p>
  
  <pre><code>import urllib2
  import json
  
  credentialGoogle = '' # Google credentials from: https://console.developers.google.com/
  searchString = 'Xbox%20One'
  top = 20
  offset = 0
  while offset &lt; top:
      url = 'https://ajax.googleapis.com/ajax/services/search/images?' + \
            'v=1.0&amp;q=%s&amp;start=%d&amp;userip=%s' % (searchString, offset, credentialGoogle)
  
      request = urllib2.Request(url)
      response = urllib2.urlopen(request)
      results = json.load(response)
  
      # process results
  
      offset += 4     # since Google API only returns 4 search results at a time
  </code></pre>
  
  <p>What would be the equivalent for Bing?  Presumably it'd start with:</p>
  
  <pre><code>keyBing = ''        # Bing key from: https://datamarket.azure.com/account/keys
  credentialBing = '' # same as key?
  searchString = '%27Xbox+One%27'
  top = 20
  offset = 0
  
  url = 'https://api.datamarket.azure.com/Bing/Search/Image?' + \
        'Query=%s&amp;$top=%d&amp;$skip=%d&amp;$format=json' % (searchString, top, offset)
  </code></pre>
  
  <p>but how are the credentials set up?</p>