0

I'm trying to load cookies into the python requests module . Using the FF extension 'advanced cookie manager' (https://www.facebook.com/cookiemanager ), I've exported cookies from firefox into a textfile that looks like:

.xxx.net    TRUE    /   FALSE   1435176898  _gat    1
.xxx.net    TRUE    /   FALSE   1498248358  _ga GA1.2.749243760.1435176299
.YYY.com    TRUE    /   FALSE   1488730321  _ga GA1.2.630339061.1425658321
.YYY.com    TRUE    /   FALSE   1472993710  __qca   P0-913150413-1425658321107
.YYY.com    TRUE    /   FALSE   1488730321  __gads  ID=8edab7af1673d945:T=1425658321:S=ALNI_Ma6b9RCM4Cm7IGSojNoWU5DohhJ0w
www.YYY.com FALSE   /   FALSE   1457194477  htg_subform_hide    1

I've come across How to send cookies in a post request with the Python Requests library?, but the accepted example:

cookie = {'enwiki_session': '17ab96bd8ffbe8ca58a78657a918558'}

refers to only one field. Each record exported in my file has 7 fields which I assume some of which are

domain , path , expires, Name

What is the best way to import these cookies into python so I can use them with requests?

Community
  • 1
  • 1
user1592380
  • 34,265
  • 92
  • 284
  • 515

1 Answers1

1

Advance Cookie Manager exports the cookies in to text file in the below format:

HOST isDomainCookie PATH IsSecure EXPIRY NAME VALUE

NOTE: TAB is the delimiter between the fields

jnns
  • 5,148
  • 4
  • 47
  • 74
Jayapal
  • 86
  • 4
  • Could you please describe your answer more detailed and format your code correctly. – bish Jul 13 '15 at 04:27