Get cookie through Tampermonkey, use cookie anywhere.
Get all Cookies even HttpOnly Cookies.
pip install cookie-cloud
$ cc_generate
Generated .cookie_cloud.json file successed.
You can move it to HOME.
Edit it!
$ vim .cookie_cloud.json
{
"github_user": "twb",
"github_repo": "cookie",
"github_token": "XXXX",
"sites": [
"github.com"
]
}
$ cc_generate
Generate GYC.js file successed.
Copy that to your Tampermonkey!
- github_user: save cookies's repo owner
- github_repo: save cookies's repo name
- github_token: github token
- sites: get cookie sites
Add Tampermonkey to your browser, then create Tampermonkey script and parse GYC.js
content, last enable it.
The Tampermonkey script while create repo and log opearations in your console.
Read config from
.cookie_cloud.json
or~/.cookie_cloud.json
Example:
>>> from cookie_cloud.util import get_cookie
>>> cookie = get_cookie('github.com', update=True, raw=False)
Argument:
-
update
True
: get cookies by requestFalse
: load cookies from '/tmp/cookies.json' or 'C:\temp\cookies.json'
-
raw:
True
: json type cookie, same as issue comment bodyFalse
: string type cookie, can be used byrequests.get(url, headers={"Cookie"=cookie})
.