Update asyncio/README.md
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
## nest_asyncio
|
||||
```python
|
||||
'Sync'
|
||||
'sync'
|
||||
def Sync():
|
||||
import asyncio, functools, importlib.util as U
|
||||
U.find_spec('nest_asyncio') or os.system('pip install -q nest_asyncio')
|
||||
@@ -21,9 +21,12 @@ async def Page():
|
||||
if callable(method := getattr(page, attr)) and not attr.startswith('_'):
|
||||
setattr(page, attr, sync(method))
|
||||
return page
|
||||
page = Page()
|
||||
page.goto('http://example.com')
|
||||
print(page.title()) # Example Domain
|
||||
|
||||
'main'
|
||||
if __name__ == '__main__':
|
||||
page = Page()
|
||||
page.goto('http://example.com')
|
||||
print(page.title()) # Example Domain
|
||||
```
|
||||
|
||||
## threading
|
||||
|
||||
Reference in New Issue
Block a user