title: JSONDecodeError: Expecting value: line 1 column 1 (char 0)
body: <p>I am getting error <code>Expecting value: line 1 column 1 (char 0)</code> when trying to decode JSON.</p>
  <p>The URL I use for the API call works fine in the browser, but gives this error when done through a curl request. The following is the code I use for the curl request.</p>
  <p>The error happens at <code>return simplejson.loads(response_json)</code></p>
  <pre><code>response_json = self.web_fetch(url)
  response_json = response_json.decode('utf-8')
  return json.loads(response_json)
  
  
  def web_fetch(self, url):
      buffer = StringIO()
      curl = pycurl.Curl()
      curl.setopt(curl.URL, url)
      curl.setopt(curl.TIMEOUT, self.timeout)
      curl.setopt(curl.WRITEFUNCTION, buffer.write)
      curl.perform()
      curl.close()
      response = buffer.getvalue().strip()
      return response
  </code></pre>
  <p>Traceback:</p>
  <pre><code>File &quot;/Users/nab/Desktop/myenv2/lib/python2.7/site-packages/django/core/handlers/base.py&quot; in get_response
    111.                         response = callback(request, *callback_args, **callback_kwargs)
  File &quot;/Users/nab/Desktop/pricestore/pricemodels/views.py&quot; in view_category
    620.     apicall=api.API().search_parts(category_id= str(categoryofpart.api_id), manufacturer = manufacturer, filter = filters, start=(catpage-1)*20, limit=20, sort_by='[[&quot;mpn&quot;,&quot;asc&quot;]]')
  File &quot;/Users/nab/Desktop/pricestore/pricemodels/api.py&quot; in search_parts
    176.         return simplejson.loads(response_json)
  File &quot;/Users/nab/Desktop/myenv2/lib/python2.7/site-packages/simplejson/__init__.py&quot; in loads
    455.         return _default_decoder.decode(s)
  File &quot;/Users/nab/Desktop/myenv2/lib/python2.7/site-packages/simplejson/decoder.py&quot; in decode
    374.         obj, end = self.raw_decode(s)
  File &quot;/Users/nab/Desktop/myenv2/lib/python2.7/site-packages/simplejson/decoder.py&quot; in raw_decode
    393.         return self.scan_once(s, idx=_w(s, idx).end())
  
  Exception Type: JSONDecodeError at /pricemodels/2/dir/
  Exception Value: Expecting value: line 1 column 1 (char 0)
  </code></pre>