Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing mimetools.Message in urllib2.urlopen
    primarykey
    data
    text
    <p>I'm using <code>urllib2.urlopen()</code>:</p> <pre><code>req = urllib2.Request('http://www.google.com') resp = urllib2.urlopen(req) print resp.info() print resp.info()['set-cookie'] Date: Sat, 14 May 2011 01:24:12 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Set-Cookie: PREF=ID=5ec78624283cc050:FF=0:TM=1305336252:LM=1305336252:S=eRXgUUuzhQbRmZxk; expires=Mon, 13-May-2013 01:24:12 GMT; path=/; domain=.google.com Set-Cookie: NID=46=GxyZVeWbT9dn0sLa9waPGSusm1hFqGf46SPqewahg0bzbYIQX0oHff0bzJ33E2yO89npEsYkqSoX0HLSqHbCxj5tCK2E931PfEJbqDMB6lTDk4ngVAiiyObWmbHgRUC9; expires=Sun, 13-Nov-2011 01:24:12 GMT; path=/; domain=.google.com; HttpOnly Server: gws X-XSS-Protection: 1; mod PREF=ID=5ec78624283cc050:FF=0:TM=1305336252:LM=1305336252:S=eRXgUUuzhQbRmZxk; expires=Mon, 13-May-2013 01:24:12 GMT; path=/; domain=.google.com, NID=46=GxyZVeWbT9dn0sLa9waPGSusm1hFqGf46SPqewahg0bzbYIQX0oHff0bzJ33E2yO89npEsYkqSoX0HLSqHbCxj5tCK2E931PfEJbqDMB6lTDk4ngVAiiyObWmbHgRUC9; expires=Sun, 13-Nov-2011 01:24:12 GMT; path=/; domain=.google.com; HttpOnly </code></pre> <p>As you can see in the headers received in the response, there are TWO statements of 'set-cookie', HOWEVER in the <code>resp.info()</code> object I receive it has grouped both cookie statements together and separates them by a ',' (comma)</p> <p>This is troublesome to separate the cookies by this delimiter since there are commas inside the cookie information i'm try to separate with this comma delimiter</p> <p>Is there an easy way to call upon each cookie string individually with this mimetools.message object? (<code>resp.info()</code>)</p> <p>else-> I'll just have to parse the headers manually without this not so helpful mimetools.message/dictionary object</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload