Dynamic Script - execute code and return browser session details.
browser_rendering.script.create(ScriptCreateParams**kwargs) -> ScriptCreateResponse
POST/accounts/{account_id}/browser-rendering/script
Acquires a browser session and runs the provided code in it. The session stays open for reuse; close it with DELETE /devtools/browser/:sessionId or browser.close(), otherwise it ends at the idle timeout.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Dynamic Script - execute code and return browser session details.
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
script = client.browser_rendering.script.create(
account_id="account_id",
code="code",
)
print(script){
"result": "string",
"success": true
}{
"errors": [
{
"code": 2001,
"message": "Rate limit exceeded"
}
],
"success": false
}Returns Examples
{
"result": "string",
"success": true
}{
"errors": [
{
"code": 2001,
"message": "Rate limit exceeded"
}
],
"success": false
}