Skip to content

Commit

Permalink
Logging, Scraping
Browse files Browse the repository at this point in the history
  • Loading branch information
gto76 committed Jul 31, 2024
1 parent 545016c commit 99be4e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2248,7 +2248,7 @@ logging.debug/info/warning/error/critical(<str>) # 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.
Expand Down Expand Up @@ -2525,7 +2525,7 @@ from selenium import webdriver
<El>.click/clear() # Also <El>.send_keys(<str>).
```

#### XPath — also available in browser's console via `'$x(<xpath>)'` and by lxml library:
#### XPath — also available in lxml, Scrapy, and browser's console via `'$x(<xpath>)'`:
```python
<xpath> = //<element>[/ or // <element>] # Child: /, Descendant: //, Parent: /..
<xpath> = //<element>/following::<element> # Next sibling. Also preceding/parent/…
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
&lt;Logger&gt;.exception(&lt;str&gt;) <span class="hljs-comment"># Error() that appends caught exception.</span>
</code></pre>
<div><h3 id="setup">Setup</h3><pre><code class="python language-python hljs">logging.basicConfig(
filename=<span class="hljs-keyword">None</span>, <span class="hljs-comment"># Logs to console (stderr) by default.</span>
filename=<span class="hljs-keyword">None</span>, <span class="hljs-comment"># Logs to stderr or appends to file.</span>
format=<span class="hljs-string">'%(levelname)s:%(name)s:%(message)s'</span>, <span class="hljs-comment"># Add '%(asctime)s' for local datetime.</span>
level=logging.WARNING, <span class="hljs-comment"># Drops messages with lower priority.</span>
handlers=[logging.StreamHandler(sys.stderr)] <span class="hljs-comment"># Uses FileHandler if filename is set.</span>
Expand Down Expand Up @@ -2073,7 +2073,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
</code></pre></div>


<div><h4 id="xpathalsoavailableinbrowsersconsoleviadxxpathandbylxmllibrary">XPath — also available in browser's console via <code class="python hljs"><span class="hljs-string">'$x(&lt;xpath&gt;)'</span></code> and by lxml library:</h4><pre><code class="python language-python hljs">&lt;xpath&gt; = //&lt;element&gt;[/ <span class="hljs-keyword">or</span> // &lt;element&gt;] <span class="hljs-comment"># Child: /, Descendant: //, Parent: /..</span>
<div><h4 id="xpathalsoavailableinlxmlscrapyandbrowsersconsoleviadxxpath">XPath — also available in lxml, Scrapy, and browser's console via <code class="python hljs"><span class="hljs-string">'$x(&lt;xpath&gt;)'</span></code>:</h4><pre><code class="python language-python hljs">&lt;xpath&gt; = //&lt;element&gt;[/ <span class="hljs-keyword">or</span> // &lt;element&gt;] <span class="hljs-comment"># Child: /, Descendant: //, Parent: /..</span>
&lt;xpath&gt; = //&lt;element&gt;/following::&lt;element&gt; <span class="hljs-comment"># Next sibling. Also preceding/parent/…</span>
&lt;element&gt; = &lt;tag&gt;&lt;conditions&gt;&lt;index&gt; <span class="hljs-comment"># `&lt;tag&gt; = */a/…`, `&lt;index&gt; = [1/2/…]`.</span>
&lt;condition&gt; = [&lt;sub_cond&gt; [<span class="hljs-keyword">and</span>/<span class="hljs-keyword">or</span> &lt;sub_cond&gt;]] <span class="hljs-comment"># For negation use `not(&lt;sub_cond&gt;)`.</span>
Expand Down

0 comments on commit 99be4e9

Please sign in to comment.