title: How to import firefox cookies to python requests
body: <p>I'm logged in on some page in <strong>Firefox</strong> and I want to take the <strong>cookie</strong> and try to browse webpage with <strong>python-requests</strong>. Problem is that after importing cookie to the requests session nothing happen (like there is no cookie at all). Structure of the cookie made by requests differ from the one from Firefox as well.
  Is such it possible to load FF cookie and use it in requests session?</p>
  
  <p>My code so far:</p>
  
  <pre><code>import sys
  import sqlite3
  import http.cookiejar as cookielib
  import requests
  from requests.utils import dict_from_cookiejar
  
  def get_cookies(final_cookie, firefox_cookies):
      con = sqlite3.connect(firefox_cookies)
      cur = con.cursor()
      cur.execute("SELECT host, path, isSecure, expiry, name, value FROM moz_cookies")
      for item in cur.fetchall():
          if item[0].find("mydomain.com") == -1:
              continue
          c = cookielib.Cookie(0, item[4], item[5],
              None, False,
              item[0], item[0].startswith('.'), item[0].startswith('.'),
              item[1], False,
              item[2],
              item[3], item[3]=="",
              None, None, {})
          final_cookie.set_cookie(c)
  
  
  
  cookie = cookielib.CookieJar()
  input_file = ~/.mozilla/firefox/myprofile.default/cookies.sqlite
  get_cookies(cookie, input_file)
  
  #print cookie given from firefox
  cookies = dict_from_cookiejar(cookie)
  for key, value in cookies.items():
      print(key, value)
  
  
  s = requests.Session()
  payload = {
  "lang" : "en",
  'destination': '/auth',
  'credential_0': sys.argv[1],
  'credential_1': sys.argv[2],
  'credential_2': '86400',
  }
  r = s.get("mydomain.com/login", data = payload)
  #print cookie from requests
  cookies = dict_from_cookiejar(s.cookies)
  for key, value in cookies.items():
      print(key, value)
  </code></pre>
  
  <p>Structure of cookies from firefox is:</p>
  
  <pre><code>_gid GA1.3.2145214.241324
  _ga GA1.3.125598754.422212
  _gat_is4u 1
  </code></pre>
  
  <p>Structure of cookies from requests is:</p>
  
  <pre><code>UISTestAuth tesskMpA8JJ23V43a%2FoFtdesrtsszpw
  </code></pre>
  
  <p>After all, when trying to assign cookies from FF to session.cookies, requests works as I import nothing.</p>