title: Python requests - JSONDecodeError("Expecting value", s, err.value) from None
body: <p>I'm trying to grab a response from an api but i cannot load it in a dictionary.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>r = session.post(url, headers=headers, json=payload)
  </code></pre>
  
  <p>The returned <code>status code</code> is <code>200</code> so i get a response.</p>
  
  <p>By trying to do: <code>reply = r.json()</code> i get:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Users/PycharmProjects/honeymonitor/main.py", line 46, in &lt;module&gt;
      data = get_data(session)
    File "C:/Users/PycharmProjects/honeymonitor/main.py", line 35, in get_data
      reply = r.json()
    File "C:\Users\PycharmProjects\honeymonitor\venv\lib\site-packages\requests\models.py", line 897, in json
      return complexjson.loads(self.text, **kwargs)
    File "C:\Users\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
      return _default_decoder.decode(s)
    File "C:\Users\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "C:\Users\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
      raise JSONDecodeError("Expecting value", s, err.value) from None
  json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  </code></pre>
  
  <p>And by using <code>reply = r.text</code> i get a lot of gibberish:</p>
  
  <pre><code>� d�M���)b�b��$�j�np������X2�Al�w{g��wO�n-���w��g�����}�1�Y5@�R��/�
  �   X���o]&gt;6,�N�_#�#Ң����K�@���s
  ��Ɩ�ː�����2��N�:D��p�����7{K��������V��
  -")�p0n@I�f!���Q�+| /We�.�p�=����u���-�ʌ�cs�"jfH����}qkː��q�,q�bږq�ٟ��Z���&gt;��U#�����ET�V/��+cU����ʁ�LLe��(���V�2���å}�UC���@�8y��B�7Λ��c���Y?��q��TOMTv{����ߎ������,�[�|��wf_�˰�g������?
  </code></pre>
  
  <p>The content type in the headers of the post request is:</p>
  
  <pre><code>'Content-Type': 'application/json;charset=UTF-8',              
  </code></pre>
  
  <p>Also by checking the <code>r.encoding</code> i get <code>None</code></p>
  
  <p>At the end i've tried <code>json.loads(r.text)</code> but i get the same error.
  Also tried encoding the response with <code>r.content.decode('utf-8')</code>
  and got <code>UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 1: invalid continuation byte</code></p>
  
  <p>What i'm doing wrong?</p>
  
  <p>EDIT:</p>
  
  <p>I've tried replicating the request with Fiddler and i can clearly see the response json there</p>
  
  <p>I've compared the response headers between Fiddler and requests, the only difference is that with requests i ge <code>'Transfer-Encoding': 'chunked'</code> in the headers</p>
  
  <p>EDIT2:</p>
  
  <p>Here's a portion of the <code>r.content</code>:</p>
  
  <pre><code>b'\x03\xd5\x01\x00d\xca9\x9cvwC\x7f \x1b]j\xfb\xc5\xa3tA\xa1k.N9\x01\x08\x03\r\xcc\x02i\x01\xb7\x0b\xc2=\xc6\x92\xb1\rb\xe3\xbf\xdb;\x83\xb7\xbf{\xe2vk\xd1\xed\xef\xbf[d&lt;{.n\x7fo\xd5WC\xab\x84\xeb\xecN\xd3#\xcc\xed\x0cAks\xa5\xe6\x87?\x15\xb3:\x8d\xfdS}\xb5O\x9a\xb8\x9d\xddK\x98\xf5+HSLq\x14\x84\xab:Fd!\xa8\xc0\x0c\xd2\xd3\x0eL\xd4\xec\x9b\xcb\xf2\xcf\xae\x18\xd9\x15&amp;fg\xbf\xd6.```
  </code></pre>