Notebooks >> Scripts
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.
 
 

179 lines
4.9 KiB

{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<!DOCTYPE html><html><head>\n",
" <title>Example Domain</title>\n",
"\n",
" <meta charset=\"utf-8\">\n",
" <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\">\n",
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n",
" <style type=\"text/css\">\n",
" body {\n",
" background-color: #f0f0f2;\n",
" margin: 0;\n",
" padding: 0;\n",
" font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n",
" \n",
" }\n",
" div {\n",
" width: 600px;\n",
" margin: 5em auto;\n",
" padding: 2em;\n",
" background-color: #fdfdff;\n",
" border-radius: 0.5em;\n",
" box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);\n",
" }\n",
" a:link, a:visited {\n",
" color: #38488f;\n",
" text-decoration: none;\n",
" }\n",
" @media (max-width: 700px) {\n",
" div {\n",
" margin: 0 auto;\n",
" width: auto;\n",
" }\n",
" }\n",
" </style> \n",
"</head>\n",
"\n",
"<body>\n",
"<div>\n",
" <h1>Example Domain</h1>\n",
" <p>This domain is for use in illustrative examples in documents. You may use this\n",
" domain in literature without prior coordination or asking for permission.</p>\n",
" <p><a href=\"https://www.iana.org/domains/example\">More information...</a></p>\n",
"</div>\n",
"\n",
"\n",
"</body></html>"
]
}
],
"source": [
"!curl -X POST http://192.168.1.101:3148/content \\\n",
"-H 'Cache-Control: no-cache' -H 'Content-Type: application/json' -d '{\"url\": \"https://example.com/\" }'"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'allowFileProtocol': False,\n",
" 'chromeRefreshTime': 1800000,\n",
" 'connectionTimeout': 600000,\n",
" 'disabledFeatures': [],\n",
" 'enableAPIGet': False,\n",
" 'enableCors': False,\n",
" 'enableHeapdump': False,\n",
" 'errorAlertURL': None,\n",
" 'exitOnHealthFailure': False,\n",
" 'functionBuiltIns': ['url'],\n",
" 'functionEnableIncognitoMode': False,\n",
" 'functionEnvVars': [],\n",
" 'functionExternals': ['lighthouse', 'node-pdftk', 'sharp'],\n",
" 'healthFailureURL': None,\n",
" 'host': '0.0.0.0',\n",
" 'keepAlive': False,\n",
" 'maxCPU': 99,\n",
" 'maxConcurrentSessions': 10,\n",
" 'maxMemory': 99,\n",
" 'maxQueueLength': 20,\n",
" 'metricsJSONPath': None,\n",
" 'port': 3000,\n",
" 'prebootChrome': False,\n",
" 'queuedAlertURL': None,\n",
" 'rejectAlertURL': None,\n",
" 'sessionCheckFailURL': None,\n",
" 'singleRun': False,\n",
" 'socketBehavior': 'http',\n",
" 'timeoutAlertURL': None,\n",
" 'token': None,\n",
" 'workspaceDir': '/home/browserless'}\n"
]
}
],
"source": [
"import requests\n",
"import pprint\n",
"response = requests.get('http://192.168.1.101:3148/config')\n",
"\n",
"pprint.pprint(response.json())\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'error': 0,\n",
" 'maxConcurrent': 1,\n",
" 'maxTime': 600000,\n",
" 'meanTime': 7610.974683544304,\n",
" 'minTime': 0,\n",
" 'queued': 0,\n",
" 'rejected': 0,\n",
" 'sessionTimes': [590, 600000, 947, 407],\n",
" 'successful': 3,\n",
" 'timedout': 1,\n",
" 'totalTime': 601944,\n",
" 'unhealthy': 0}\n"
]
}
],
"source": [
"import requests\n",
"import pprint\n",
"\n",
"response = requests.get('http://192.168.1.101:3148/metrics/total')\n",
"\n",
"pprint.pprint(response.json())"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.4 64-bit",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}