Asynchronous splinter wrapper Python library
Project description
aiosplinter - asynchronous splinter wrapper Python library
Asynchronous splinter wrapper Python library
Installation
To install from PyPI run:
$ pip install aiosplinter
Usage
See splinter
documentation, because aiosplinter
uses the same API as
splinter
with 2 exceptions:
- All functions are converted to coroutines, that means you have to add
await
keyword before all function calls. - To asynchronously create classes from
aiosplinter
use static methodcreate
.
Example (open https://google.com with chrome
, make screenshot and show it in default browser):
#!/usr/bin/env python
import asyncio
import webbrowser
from pathlib import Path
import aiosplinter
browser_name = 'chrome'
browser = asyncio.run(aiosplinter.Browser(driver_name=browser_name))
url = 'https://google.com'
asyncio.run(browser.visit(url=url))
screenshot_filename_base = str(Path('~/google.com_screenshot_').expanduser())
screenshot_filename = asyncio.run(browser.screenshot(name=screenshot_filename_base, full=True))
webbrowser.open(url=f'file://{screenshot_filename}')
asyncio.run(browser.quit())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiosplinter-0.1.2.tar.gz
(6.3 kB
view hashes)
Built Distribution
Close
Hashes for aiosplinter-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3c2671cc24c6d6d41024ed746305c16829c61f7dcc340b8ad7d5fcf55f6dff4 |
|
MD5 | a0a8b581cca4383325e6c7c336eec642 |
|
BLAKE2b-256 | f9baa3be9249f5e6e9fb16940f91c17a7127237c3e46351d38d3699735535366 |