ipykernel-helper 0.0.11__tar.gz → 0.0.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. {ipykernel_helper-0.0.11/ipykernel_helper.egg-info → ipykernel_helper-0.0.12}/PKG-INFO +2 -1
  2. ipykernel_helper-0.0.12/ipykernel_helper/__init__.py +2 -0
  3. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/ipykernel_helper/_modidx.py +1 -0
  4. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/ipykernel_helper/core.py +6 -3
  5. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12/ipykernel_helper.egg-info}/PKG-INFO +2 -1
  6. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/ipykernel_helper.egg-info/requires.txt +1 -0
  7. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/settings.ini +2 -2
  8. ipykernel_helper-0.0.11/ipykernel_helper/__init__.py +0 -2
  9. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/LICENSE +0 -0
  10. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/MANIFEST.in +0 -0
  11. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/README.md +0 -0
  12. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/ipykernel_helper.egg-info/SOURCES.txt +0 -0
  13. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/ipykernel_helper.egg-info/dependency_links.txt +0 -0
  14. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/ipykernel_helper.egg-info/entry_points.txt +0 -0
  15. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/ipykernel_helper.egg-info/not-zip-safe +0 -0
  16. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/ipykernel_helper.egg-info/top_level.txt +0 -0
  17. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/pyproject.toml +0 -0
  18. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/setup.cfg +0 -0
  19. {ipykernel_helper-0.0.11 → ipykernel_helper-0.0.12}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipykernel-helper
3
- Version: 0.0.11
3
+ Version: 0.0.12
4
4
  Summary: Helpers for ipykernel and friends
5
5
  Home-page: https://github.com/AnswerDotAI/ipykernel-helper
6
6
  Author: Jeremy Howard
@@ -25,6 +25,7 @@ Requires-Dist: ipython
25
25
  Requires-Dist: ipykernel
26
26
  Requires-Dist: beautifulsoup4
27
27
  Requires-Dist: html2text
28
+ Requires-Dist: cloudscraper
28
29
  Provides-Extra: dev
29
30
  Dynamic: author
30
31
  Dynamic: author-email
@@ -0,0 +1,2 @@
1
+ __version__ = "0.0.12"
2
+ from .core import *
@@ -30,4 +30,5 @@ d = { 'settings': { 'branch': 'main',
30
30
  'ipykernel_helper/core.py'),
31
31
  'ipykernel_helper.core.read_url': ('core.html#read_url', 'ipykernel_helper/core.py'),
32
32
  'ipykernel_helper.core.run_cmd': ('core.html#run_cmd', 'ipykernel_helper/core.py'),
33
+ 'ipykernel_helper.core.scrape_url': ('core.html#scrape_url', 'ipykernel_helper/core.py'),
33
34
  'ipykernel_helper.core.transient': ('core.html#transient', 'ipykernel_helper/core.py')}}}
@@ -3,7 +3,7 @@
3
3
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
4
4
 
5
5
  # %% auto 0
6
- __all__ = ['transient', 'run_cmd', 'get_md', 'read_url', 'load_ipython_extension']
6
+ __all__ = ['transient', 'run_cmd', 'get_md', 'scrape_url', 'read_url', 'load_ipython_extension']
7
7
 
8
8
  # %% ../nbs/00_core.ipynb
9
9
  from fastcore.meta import delegates
@@ -13,6 +13,7 @@ from inspect import signature, currentframe
13
13
  from functools import cmp_to_key,partial
14
14
  from collections.abc import Mapping
15
15
  from textwrap import dedent
16
+ from cloudscraper import create_scraper
16
17
  from toolslm.funccall import *
17
18
 
18
19
  import typing,warnings,re
@@ -151,6 +152,9 @@ def get_md(cts):
151
152
  def _f(m): return f'```\n{dedent(m.group(1))}\n```'
152
153
  return re.sub(r'\[code]\s*\n(.*?)\n\[/code]', _f, res or '', flags=re.DOTALL).strip()
153
154
 
155
+ # %% ../nbs/00_core.ipynb
156
+ def scrape_url(url): return create_scraper().get(url)
157
+
154
158
  # %% ../nbs/00_core.ipynb
155
159
  def read_url(
156
160
  url:str, # URL to read
@@ -159,11 +163,10 @@ def read_url(
159
163
  selector:str=None # Select section(s) using BeautifulSoup.select (overrides extract_section)
160
164
  ):
161
165
  "Read URL and return contents"
162
- import httpx
163
166
  from urllib.parse import urlparse
164
167
  from bs4 import BeautifulSoup
165
168
 
166
- res = httpx.get(url, follow_redirects=True).raise_for_status().text
169
+ res = scrape_url(url).text
167
170
  soup = BeautifulSoup(res, "html.parser")
168
171
 
169
172
  if selector:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ipykernel-helper
3
- Version: 0.0.11
3
+ Version: 0.0.12
4
4
  Summary: Helpers for ipykernel and friends
5
5
  Home-page: https://github.com/AnswerDotAI/ipykernel-helper
6
6
  Author: Jeremy Howard
@@ -25,6 +25,7 @@ Requires-Dist: ipython
25
25
  Requires-Dist: ipykernel
26
26
  Requires-Dist: beautifulsoup4
27
27
  Requires-Dist: html2text
28
+ Requires-Dist: cloudscraper
28
29
  Provides-Extra: dev
29
30
  Dynamic: author
30
31
  Dynamic: author-email
@@ -5,5 +5,6 @@ ipython
5
5
  ipykernel
6
6
  beautifulsoup4
7
7
  html2text
8
+ cloudscraper
8
9
 
9
10
  [dev]
@@ -1,11 +1,11 @@
1
1
  [DEFAULT]
2
2
  repo = ipykernel-helper
3
3
  lib_name = ipykernel-helper
4
- version = 0.0.11
4
+ version = 0.0.12
5
5
  min_python = 3.9
6
6
  license = apache2
7
7
  black_formatting = False
8
- requirements = fastcore toolslm>=0.2.0 jedi ipython ipykernel beautifulsoup4 html2text
8
+ requirements = fastcore toolslm>=0.2.0 jedi ipython ipykernel beautifulsoup4 html2text cloudscraper
9
9
  cell_number = False
10
10
  doc_path = _docs
11
11
  lib_path = ipykernel_helper
@@ -1,2 +0,0 @@
1
- __version__ = "0.0.11"
2
- from .core import *