From 99be4e91e689adb766710a1158caa982d295f355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 31 Jul 2024 22:43:00 +0200 Subject: [PATCH] Logging, Scraping --- README.md | 4 ++-- index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 48f59d17..be8593db 100644 --- a/README.md +++ b/README.md @@ -2248,7 +2248,7 @@ logging.debug/info/warning/error/critical() # Logs to the root logger. ### Setup ```python logging.basicConfig( - filename=None, # Logs to console (stderr) by default. + filename=None, # Logs to stderr or appends to file. format='%(levelname)s:%(name)s:%(message)s', # Add '%(asctime)s' for local datetime. level=logging.WARNING, # Drops messages with lower priority. handlers=[logging.StreamHandler(sys.stderr)] # Uses FileHandler if filename is set. @@ -2525,7 +2525,7 @@ from selenium import webdriver .click/clear() # Also .send_keys(). ``` -#### XPath — also available in browser's console via `'$x()'` and by lxml library: +#### XPath — also available in lxml, Scrapy, and browser's console via `'$x()'`: ```python = //[/ or // ] # Child: /, Descendant: //, Parent: /.. = ///following:: # Next sibling. Also preceding/parent/… diff --git a/index.html b/index.html index b3297eb1..02962d69 100644 --- a/index.html +++ b/index.html @@ -1844,7 +1844,7 @@

Format

# Error() that appends caught exception.

Setup

logging.basicConfig(
-    filename=None,                                   # Logs to console (stderr) by default.
+    filename=None,                                   # Logs to stderr or appends to file.
     format='%(levelname)s:%(name)s:%(message)s',     # Add '%(asctime)s' for local datetime.
     level=logging.WARNING,                           # Drops messages with lower priority.
     handlers=[logging.StreamHandler(sys.stderr)]     # Uses FileHandler if filename is set.
@@ -2073,7 +2073,7 @@ 

Format

XPath — also available in browser's console via '$x(<xpath>)' and by lxml library:

<xpath>     = //<element>[/ or // <element>]           # Child: /, Descendant: //, Parent: /..
+

XPath — also available in lxml, Scrapy, and browser's console via '$x(<xpath>)':

<xpath>     = //<element>[/ or // <element>]           # Child: /, Descendant: //, Parent: /..
 <xpath>     = //<element>/following::<element>         # Next sibling. Also preceding/parent/…
 <element>   = <tag><conditions><index>                 # `<tag> = */a/…`, `<index> = [1/2/…]`.
 <condition> = [<sub_cond> [and/or <sub_cond>]]         # For negation use `not(<sub_cond>)`.