Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#!/usr/bin/env python3 from requests_html import HTMLSession @service def scrape_web(url=None, entity_id=None): def sesja(url): session = HTMLSession() r = task.executor(session.get, url) #r.html.render() # to nie działa title = r.html.find("h1", first=True) return title a = sesja(url) log.info(a.text) state.set(entity_id, value=a.text) 2022-12-29 18:52:54.680 ERROR (MainThread) [custom_components.pyscript.file.test.scrape_web] Exception in
line 12: r.html.render() # to nie działa ^ RuntimeError: Cannot use HTMLSession within an existing event loop. Use AsyncHTMLSession instead.
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)