add --cookies argument to read cookies from file #31

Closed
wants to merge 7 commits into
from

Conversation

Projects
None yet
2 participants

Hi,

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:
https://chrome.google.com/webstore/detail/lopabhfecdfhgogdbojmaicoicjekelh

And then I can use the cookies right off my pasteboard:

./webkit2png --cookies <(pbpaste) https://github.com/

RSully commented Jun 17, 2013

👍 I would love a way to send cookies along with a request. Hope to see this (or similar) merged in.

Alex added some commits Aug 16, 2012

Alex set a single cookie
Use NSMutableURLRequest rather than NSURLRequest, and call
setValue:forHTTPHeaderField:.
1658f7e
Alex add --cookies argument
This specifies a Netscape cookie filename to read from.
900c9ef
Alex read cookies from a file 1ddc935
Alex change cookie handling to use urllib2 and cookielib 9328a14
Alex 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"
bdfe3cf
Alex commenting and function name cleanup 75cca0d
Alex change indent from 2 to 4 c5a4f69

recreated as #47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment