FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cefpython/examples/snippets/setcookie.py at cefpython49-winxp · pythonthings/cefpython · GitHub
pythonthings
cefpython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cefpython
/
examples
/
snippets
/
setcookie.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (31 loc) · 949 Bytes
Breadcrumbs
cefpython
/
examples
/
snippets
/
setcookie.py
Copy path
File metadata and controls
36 lines (31 loc) · 949 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Shows how to set a cookie.
"""
from
cefpython3
import
cefpython
as
cef
import
datetime
def
main
():
cef
.
Initialize
()
cef
.
CreateBrowserSync
(
url
=
"http://www.html-kit.com/tools/cookietester/"
,
window_title
=
"Set a cookie"
)
manager
=
cef
.
CookieManager
.
GetGlobalManager
()
cookie
=
cef
.
Cookie
()
cookie
.
Set
({
"name"
:
"my_cookie"
,
"value"
:
"my_value"
,
# Make sure domain is a valid value otherwise it crashes
# app (Issue #459)
"domain"
:
"www.html-kit.com"
,
"path"
:
"/"
,
"secure"
:
False
,
"httpOnly"
:
False
,
"creation"
:
datetime
.
datetime
(
2018
,
8
,
22
),
"lastAccess"
:
datetime
.
datetime
(
2018
,
8
,
22
),
"hasExpires"
:
True
,
"expires"
:
datetime
.
datetime
(
2028
,
12
,
31
,
23
,
59
,
59
),
})
manager
.
SetCookie
(
"http://www.html-kit.com/"
,
cookie
)
cef
.
MessageLoop
()
cef
.
Shutdown
()
if
__name__
==
'__main__'
:
main
()
Back
|
FazBrowse Home
|
New Git URL