title: I cant login instagram with requests Python (bad request 400)
body: <p>Hello i am trying to do a project with python requests. But when i try to login instagram turns me this:</p>
  
  <p>**
  bound method Response.json of Response [400]
  **</p>
  
  <p>my codes:</p>
  
  <pre><code>import os
  import requests
  import getpass
  import json
  import io
  import time
  
  X_SECOND = 2
  BASE_URL = "https://www.instagram.com/"
  LOGIN_URL = BASE_URL + "accounts/login/ajax/"
  USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; ) Gecko/20100101 Firefox/65.0"
  CHANGE_URL = "https://www.instagram.com/accounts/web_change_profile_picture/"
  CHNAGE_DATA = {"Content-Disposition": "form-data", "name": "profile_pic",
                 "filename": "profilepic.jpg", "Content-Type": "image/jpeg"}
  headers = {
      "Host": "www.instagram.com",
      "Accept": "*/*",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept-Encoding": "gzip, deflate, br",
      "Referer": "https://www.instagram.com/accounts/edit/",
      "X-IG-App-ID": "936619743392459",
      "X-Requested-With": "XMLHttpRequest",
      "DNT": "1",
      "Connection": "keep-alive",
  }
  session = requests.Session()
  session.headers = {'user-agent': USER_AGENT, 'Referer': BASE_URL}
  
  
  def login():
      USERNAME = str(input('Username &gt; '))
      PASSWD = getpass.getpass('Password &gt; ')
      resp = session.get(BASE_URL)
      session.headers.update({'X-CSRFToken': resp.cookies['csrftoken']})
      login_data = {'username': USERNAME, 'password': PASSWD}
      login_resp = session.post(LOGIN_URL, data=login_data, allow_redirects=True)
      session.headers.update({'X-CSRFToken': resp.cookies['csrftoken']})
      if login_resp.json()['authenticated']:
          print("Login successful")
      else:
          print("Login failed!")
          login()
      # print(login.json())
      session.headers.update({'X-CSRFToken': login_resp.cookies['csrftoken']})
  </code></pre>
  
  <p>i think problem isnt about my codes. </p>