# normal-playwright-api **Repository Path**: eloco/normal-playwright-api ## Basic Information - **Project Name**: normal-playwright-api - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-04-24 - **Last Updated**: 2024-09-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # normal-playwright-api a playwright ASYNC API inside docker > upgrade to async api! ## INTRO link to: - https://github.com/Eloco/aws-lambda-playwright note: it can run on local docker or container like heroku ## pull or build [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Eloco/normal-playwright-api) ``` docker pull ghcr.io/eloco/normal-playwright-api:latest docker run --rm=True -p 8080:8080 ghcr.io/eloco/normal-playwright-api:latest ``` ## Usage ``` param = { run : "result='hello Flask POST'" ; # base64 or normal run code browser : "webkit" ; # browser name (webkit or firefox or chromium) device : "iPhone X" ; # device for webkit stealth : false ; # if stealth mode reindent : true ; # if reindent run code } ``` >device can see here https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json ``` $ bs64=`echo "await page.goto('http://whatsmyuseragent.org/',wait_until='commit'); result=await page.content()" | base64 -w 0` $ http -f POST http://127.0.0.1:8080/post run=${bs64} browser="webkit" device="iphone 6" stealth="True" | jq .result | html2text | sed -r "s/\\\n//g" | $grep -v '^\s*$' | grep -v '^"' What's my User Agent? Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/16.0 Mobile/15A372 Safari/604.1 My IP Address: xx.xx.xx.xx Copyright © What's my User Agent 2015 ``` ## Other BTW: if u need to set proxy, marksure add the code into your post['run']: >https://playwright.dev/python/docs/network >You can configure pages to load over the HTTP(S) proxy or SOCKSv5. Proxy can be either set globally for the entire browser, or for each browser context individually. You can optionally specify username and password for HTTP(S) proxy, you can also specify hosts to bypass proxy for. ``` browser = await chromium.launch(proxy={ "server": "http://myproxy.com:3128", "username": "usr", "password": "pwd" }) ```