Thanks for writing such a handy script, I didn't know about pyobjc until I saw webkit2png, and it's very cool! I added a command line switch to pass in a cookie file, which is parsed with cookielib and urllib2.
As an example, I use this Chrome Extension to copy out my cookies:
And then I can use the cookies right off my pasteboard:
./webkit2png --cookies <(pbpaste) https://github.com/
👍 I would love a way to send cookies along with a request. Hope to see this (or similar) merged in.
set a single cookie
Use NSMutableURLRequest rather than NSURLRequest, and call
add --cookies argument
This specifies a Netscape cookie filename to read from.
read cookies from a file
change cookie handling to use urllib2 and cookielib
use a tempfile to guarantee magic string is present
cookielib won't even *look* at the rest of a cookie file unless the
first line matches:
magic_re = "#( Netscape)? HTTP Cookie File"
commenting and function name cleanup
change indent from 2 to 4
recreated as #47