alptangall commited on
Commit
8fc812e
·
verified ·
1 Parent(s): 342cd9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -1,7 +1,18 @@
1
  from fastapi import FastAPI
 
 
2
 
3
- app = FastAPI()
 
 
 
 
 
 
 
 
 
4
 
5
  @app.get("/")
6
  def greet_json():
7
- return {"Hello": "World!"}
 
1
  from fastapi import FastAPI
2
+ from playwright.async_api import async_playwright
3
+ import asyncio
4
 
5
+ async def action():
6
+ async with async_playwright() as p:
7
+ browser = await p.firefox.launch(headless=False)
8
+ context = await browser.new_context(user_agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36")
9
+ page = await context.new_page()
10
+ await page.goto('https://trends.google.com/trending?geo=US&hl=en-US')
11
+ rs=await page.content()
12
+ print(rs)
13
+ asyncio.run(action())
14
+ '''app = FastAPI()
15
 
16
  @app.get("/")
17
  def greet_json():
18
+ return {"Hello": "World!"}'''