LinkInCell 0.0.1__tar.gz → 0.0.2__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.
- {linkincell-0.0.1/src/LinkInCell.egg-info → linkincell-0.0.2}/PKG-INFO +1 -1
- {linkincell-0.0.1 → linkincell-0.0.2}/setup.py +1 -1
- linkincell-0.0.2/src/LinkInCell/web.py +28 -0
- {linkincell-0.0.1 → linkincell-0.0.2/src/LinkInCell.egg-info}/PKG-INFO +1 -1
- {linkincell-0.0.1 → linkincell-0.0.2}/src/LinkInCell.egg-info/SOURCES.txt +1 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/LICENSE +0 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/README.md +0 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/pyproject.toml +0 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/setup.cfg +0 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/src/LinkInCell/__init__.py +0 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/src/LinkInCell/custom_exception.py +0 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/src/LinkInCell/logger.py +0 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/src/LinkInCell/youtube.py +0 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/src/LinkInCell.egg-info/dependency_links.txt +0 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/src/LinkInCell.egg-info/requires.txt +0 -0
- {linkincell-0.0.1 → linkincell-0.0.2}/src/LinkInCell.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import urllib.request
|
|
2
|
+
from IPython import display
|
|
3
|
+
from LinkInCell.custom_exception import InvalidURLException
|
|
4
|
+
from LinkInCell.logger import logger
|
|
5
|
+
|
|
6
|
+
from urllib import response
|
|
7
|
+
def is_valid(URL: str)-> bool:
|
|
8
|
+
try:
|
|
9
|
+
response_status = urllib.request.urlopen(URL).getcode()
|
|
10
|
+
assert response_status == 200
|
|
11
|
+
logger.debug(f"response_status: {response_status}")
|
|
12
|
+
return True
|
|
13
|
+
|
|
14
|
+
except Exception as e:
|
|
15
|
+
logger.exception(e)
|
|
16
|
+
return False
|
|
17
|
+
|
|
18
|
+
def render_web(url: str, width: str="100%", height: str="600")-> str:
|
|
19
|
+
try:
|
|
20
|
+
if is_valid(url):
|
|
21
|
+
response = display.IFrame(src=url, width=width, height=height)
|
|
22
|
+
display.display(response)
|
|
23
|
+
return "Success."
|
|
24
|
+
else:
|
|
25
|
+
raise InvalidURLException
|
|
26
|
+
except Exception as e:
|
|
27
|
+
raise e
|
|
28
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|