(self, info, url, width, height)
| 19 | ) |
| 20 | |
| 21 | def resolve_screenshot(self, info, url, width, height): |
| 22 | with sync_playwright() as p: |
| 23 | browser_type = p.chromium |
| 24 | browser = browser_type.launch() |
| 25 | page = browser.new_page() |
| 26 | page.set_viewport_size({"width": width, "height": height}) |
| 27 | page.goto(url) |
| 28 | img_byte = page.screenshot(full_page=True) |
| 29 | # encoded_img = "data:image/png;base64," + base64.b64encode( |
| 30 | # img_byte).decode() |
| 31 | encoded_img = base64.b64encode(img_byte).decode() |
| 32 | browser.close() |
| 33 | return encoded_img |
| 34 | |
| 35 | |
| 36 | app = FastAPI( |
nothing calls this directly
no outgoing calls
no test coverage detected