Skip to content

Commit

Permalink
release 4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lidong committed Jun 4, 2024
1 parent 0f8c1ac commit 272c794
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 38 deletions.
2 changes: 1 addition & 1 deletion ichrome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .logs import logger
from .pool import ChromeEngine

__version__ = "4.0.1"
__version__ = "4.0.2"
__tips__ = "[github]: https://github.com/ClericPy/ichrome\n[cdp]: https://chromedevtools.github.io/devtools-protocol/\n[cmd args]: https://peter.sh/experiments/chromium-command-line-switches/"
__all__ = [
"ChromeDaemon",
Expand Down
51 changes: 15 additions & 36 deletions ichrome/routers/fastapi_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,6 @@

__doc__ = """
# ======================= server code ===========================
import uvicorn
from fastapi import FastAPI
from ichrome import AsyncTab
from ichrome.routers.fastapi_routes import ChromeAPIRouter
app = FastAPI()
# reset max_msg_size and window size for a large size screenshot
AsyncTab._DEFAULT_WS_KWARGS["max_msg_size"] = 10 * 1024**2
app.include_router(
ChromeAPIRouter(headless=True, extra_config=["--window-size=1920,1080"]),
prefix="/chrome",
)
uvicorn.run(app, port=8009)
# view url with your browser
# http://127.0.0.1:8009/chrome/screenshot?url=http://bing.com
# http://127.0.0.1:8009/chrome/download?url=http://bing.com
# ======================= client code ===========================
from inspect import getsource
import requests
Expand Down Expand Up @@ -68,22 +45,25 @@
)
# <html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">{
# "args": {
# "a": "1",
# "my_query": "OK"
# },
# },
# "headers": {
# "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
# "Accept-Encoding": "gzip, deflate",
# "Cookie": "my_cookie1=OK",
# "Host": "httpbin.org",
# "My-Header": "OK",
# "Upgrade-Insecure-Requests": "1",
# "User-Agent": "OK",
# "X-Amzn-Trace-Id": "Root=1-654d0157-04ab908a3779add762b164e3"
# },
# "origin": "0.0.0.0",
# "url": "http://httpbin.org/get?my_query=OK"
# "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
# "Accept-Encoding": "gzip, deflate",
# "Cookie": "my_cookie1=OK",
# "Host": "httpbin.org",
# "My-Header": "OK",
# "Upgrade-Insecure-Requests": "1",
# "User-Agent": "OK",
# "X-Amzn-Trace-Id": "Root=1-654d0664-74457b4317c2f41d17b6a823"
# },
# "origin": "1.1.1.1",
# "url": "http://httpbin.org/get?a=1&amp;my_query=OK"
# }
# </pre></body></html>
# '"Herman Melville - Moby-Dick"'
# "<html><head><meta name=\"color-scheme\" content=\"light dark\"></head><body><pre style=\"word-wrap: break-word; white-space: pre-wrap;\">{\n \"origin\": \"103.171.177.94\"\n}\n</pre></body></html>"
# 2. test tab_callback
Expand Down Expand Up @@ -124,7 +104,6 @@ async def tab_callback(task, tab, data, timeout):
).text
)
# "<html><head><meta name=\"color-scheme\" content=\"light dark\"></head><body><pre style=\"word-wrap: break-word; white-space: pre-wrap;\">{\n \"origin\": \"103.171.177.94\"\n}\n</pre></body></html>"
"""


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
linux:
rm -rf "dist/*";rm -rf "build/*";python3 setup.py bdist_wheel;twine upload "dist/*;rm -rf "dist/*";rm -rf "build/*""
win32-git-bash:
rm -r -Force dist;rm -r -Force build;python3 setup.py bdist_wheel;twine upload "dist/*";rm -r -Force dist;rm -r -Force build;rm -r -Force ichrome.egg-info
rm -r -f dist;rm -r -f build;python3 setup.py bdist_wheel;twine upload "dist/*";rm -r -f dist;rm -r -f build;rm -r -f ichrome.egg-info
"""
version = __version__
if sys.version_info < (3, 7):
Expand Down

0 comments on commit 272c794

Please sign in to comment.