title: Unable to import cookies from a csv file into a Requests Cookie Jar in Python
body: <p>I am new to Python (Python 3.8.3) and I want to perform the following task:</p>
  <p>After fetching cookies from a Selenium session and storing them in a csv file, I subsequently want to import them into my Requests Cookie Jar.</p>
  <p>This works flawlessly, if I import the cookie(s) manually by putting them in a list at the beginning of my script:</p>
  <pre><code>import requests
  import csv
  
  cookie_list = [
  
      [{'domain': 'en.wikipedia.org', 'httpOnly': False, 'name': […]}],
      [{'domain': 'en.wikipedia.org', 'httpOnly': False, 'name': […]}],
      [{'domain': 'en.wikipedia.org', 'httpOnly': False, 'name': […]}]
  
  ]
  
  sm = requests.Session()
  
  cookie_set = random.choice(cookie_list)
  print(cookie_set)
  
  jar = requests.cookies.RequestsCookieJar()
  for cookie in cookie_set:
      jar.set(cookie['name'], cookie['value'], domain='en.wikipedia.org')
  sm.cookies = jar
  </code></pre>
  <p>As soon as I try to import the cookies from a separate csv file, storing cookies from different sessions in separate rows, and try to set them in the Requests Cookie Jar, my script encounters an issue and gets the error code:</p>
  <pre><code>with open('testcookie.csv') as ck:
      csvReader = csv.reader(ck)
      cookies = list(csvReader)
  
  sm = requests.Session()
  
  cookie_set = cookies[1][0]
  print(cookie_set)
  
  jar = requests.cookies.RequestsCookieJar()
  for cookie in cookie_set:
      jar.set(cookie['name'], cookie['value'], domain='en.wikipedia.org')
  sm.cookies = jar
  _________________________________________________________________
  
  Traceback (most recent call last):
  jar.set(cookie['name'], cookie['value'], domain='en.wikipedia.org')
  TypeError: string indices must be integers
  </code></pre>
  <p>I am pretty confused because the rows are absolutely the same no matter if I print out <code>(print(cookie_set))</code> a row from the manual created list or from the csv file after reading all rows into a list and index into that.</p>
  <p>This is how my csv file looks like:<a href="https://i.stack.imgur.com/P5Azm.png" rel="nofollow noreferrer">testcookie.csv</a></p>
  <p>What is the cause for this error code and how can I import the cookies from my csv file, that stores cookies from different sessions in each row?</p>
  <p>I appreciate your help! Thanks in advance </p>