forked from cztomczak/cefpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathissue517.py
More file actions
43 lines (37 loc) · 871 Bytes
/
issue517.py
File metadata and controls
43 lines (37 loc) · 871 Bytes
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
37
38
39
40
41
42
43
# coding=utf8
from cefpython3 import cefpython as cef
import sys
html = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
window.onload = function() {
fetch('http://127.0.0.1:8000', {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: 'key=' + encodeURI('🍣 asd'),
}).then().catch();
}
</script>
</body>
</html>
"""
class RequestHandler:
def GetResourceHandler(self, browser, frame, request):
print(request.GetPostData())
return None
def main():
sys.excepthook = cef.ExceptHook
cef.Initialize()
browser = cef.CreateBrowserSync(url=cef.GetDataUrl(html))
browser.SetClientHandler(RequestHandler())
cef.MessageLoop()
del browser
cef.Shutdown()
if __name__ == '__main__':
main()