You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9.6 KiB
9.6 KiB
<html>
<head>
</head>
</html>
Splash¶
In [27]:
import json
import pprint
import requests
resp = requests.post(
"https://kong.donavanaldrich.com/splash",
json={
"url": "http://example.com",
"history": 1,
"html": 1,
"request_body": 1,
"har": 1,
},
)
png_data = resp.content
pp = pprint.PrettyPrinter(indent=4, sort_dicts=True)
pp.pprint(png_data)
(b'{"url": "http://example.com/", "requestedUrl": "http://example.com/", "geome'
b'try": [0, 0, 1024, 768], "title": "Example Domain", "html": "<!DOCTYPE html>'
b'<html><head>\\n <title>Example Domain</title>\\n\\n <meta charset=\\"u'
b'tf-8\\">\\n <meta http-equiv=\\"Content-type\\" content=\\"text/html; '
b'charset=utf-8\\">\\n <meta name=\\"viewport\\" content=\\"width=device'
b'-width, initial-scale=1\\">\\n <style type=\\"text/css\\">\\n body '
b'{\\n background-color: #f0f0f2;\\n margin: 0;\\n paddi'
b'ng: 0;\\n font-family: -apple-system, system-ui, BlinkMacSystemFon'
b't, \\"Segoe UI\\", \\"Open Sans\\", \\"Helvetica Neue\\", Helvetica, Arial'
b', sans-serif;\\n \\n }\\n div {\\n width: 600px;\\n '
b' margin: 5em auto;\\n padding: 2em;\\n background-color'
b': #fdfdff;\\n border-radius: 0.5em;\\n box-shadow: 2px 3px 7'
b'px 2px rgba(0,0,0,0.02);\\n }\\n a:link, a:visited {\\n color:'
b' #38488f;\\n text-decoration: none;\\n }\\n @media (max-width:'
b' 700px) {\\n div {\\n margin: 0 auto;\\n width'
b': auto;\\n }\\n }\\n </style> \\n</head>\\n\\n<body>\\n<div'
b'>\\n <h1>Example Domain</h1>\\n <p>This domain is for use in illustr'
b'ative examples in documents. You may use this\\n domain in literature '
b'without prior coordination or asking for permission.</p>\\n <p><a href'
b'=\\"https://www.iana.org/domains/example\\">More information...</a></p>\\n<'
b'/div>\\n\\n\\n</body></html>", "history": [], "har": {"log": {"version": "1'
b'.2", "creator": {"name": "Splash", "version": "3.5"}, "browser": {"name": "Q'
b'WebKit", "version": "602.1", "comment": "PyQt 5.14.2, Qt 5.14.1"}, "entries"'
b': [], "pages": [{"id": "1", "title": "Example Domain", "startedDateTime": "2'
b'021-10-26T03:50:20.767475Z", "pageTimings": {"onContentLoad": 4, "onLoad": 2'
b'3, "_onStarted": 1, "_onPrepareStart": 23, "_onIframesRendered": 24}}]}}}')
In [2]:
%pip install httpie
!http POST https://kong.donavanaldrich.com/splash url=http://example.com har:=1 html:=1 png:=1 history:=1 console:=1
Defaulting to user installation because normal site-packages is not writeable
Collecting httpie
Downloading httpie-3.2.1-py3-none-any.whl (124 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.0/125.0 KB 1.8 MB/s eta 0:00:00a 0:00:01
Requirement already satisfied: pip in /usr/lib/python3/dist-packages (from httpie) (22.0.2)
Requirement already satisfied: multidict>=4.7.0 in /home/donaldrich/.local/lib/python3.10/site-packages (from httpie) (6.0.2)
Requirement already satisfied: requests[socks]>=2.22.0 in /usr/lib/python3/dist-packages (from httpie) (2.25.1)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from httpie) (59.6.0)
Requirement already satisfied: rich>=9.10.0 in /home/donaldrich/.local/lib/python3.10/site-packages (from httpie) (12.4.4)
Requirement already satisfied: defusedxml>=0.6.0 in /home/donaldrich/.local/lib/python3.10/site-packages (from httpie) (0.7.1)
Collecting requests-toolbelt>=0.9.1
Using cached requests_toolbelt-0.9.1-py2.py3-none-any.whl (54 kB)
Requirement already satisfied: Pygments>=2.5.2 in /home/donaldrich/.local/lib/python3.10/site-packages (from httpie) (2.12.0)
Collecting charset-normalizer>=2.0.0
Using cached charset_normalizer-2.1.0-py3-none-any.whl (39 kB)
Collecting PySocks!=1.5.7,>=1.5.6
Downloading PySocks-1.7.1-py3-none-any.whl (16 kB)
Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in /home/donaldrich/.local/lib/python3.10/site-packages (from rich>=9.10.0->httpie) (0.9.1)
Installing collected packages: requests-toolbelt, PySocks, charset-normalizer, httpie
Successfully installed PySocks-1.7.1 charset-normalizer-2.1.0 httpie-3.2.1 requests-toolbelt-0.9.1
Note: you may need to restart the kernel to use updated packages.
HTTP/1.1 404 Not Found
CF-Cache-Status: DYNAMIC
CF-RAY: 738eaac46e3e9f0a-DFW
Connection: keep-alive
Content-Length: 0
Date: Thu, 11 Aug 2022 05:45:47 GMT
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=KMwuG83peUj0Eb0KdC4TpbV04BRgFZJfc9kuZ0pAAB7i3CBBxRPPQvw6BJrQgw1FgPGvY1cxMOHPpWfm4ioawmG8T73vyyOB0Jy8424rGniO5s7VJlDc2kbHzGlBx1EwE3cnNxcfK45pZg%3D%3D"}],"group":"cf-nel","max_age":604800}
Server: cloudflare
Strict-Transport-Security: max-age=15552000; includeSubDomains; preload
X-Content-Type-Options: nosniff
access-control-allow-credentials: true
access-control-allow-origin: donavanaldrich.com
access-control-expose-headers: Origin,Authorization
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
ratelimit-limit: 5
ratelimit-remaining: 4
ratelimit-reset: 1
vary: Origin
via: kong/2.8.1
www-authenticate: Key realm="kong"
x-cache-status: Bypass
x-kong-proxy-latency: 16
x-kong-upstream-latency: 119
x-ratelimit-limit-minute: 60
x-ratelimit-limit-second: 5
x-ratelimit-remaining-minute: 59
x-ratelimit-remaining-second: 4