# This file is a part of Bookmarks database and Internet robot.
#
# __author__ = "Oleg Broytman <phd@phdru.name>"
-# __copyright__ = "Copyright (C) 2000-2023 PhiloSoft Design"
+# __copyright__ = "Copyright (C) 2000-2024 PhiloSoft Design"
# __license__ = "GNU GPL"
#
-VERSION=5.0.0
+VERSION=5.1.0
EXAMPLE_SHELL=\
bkmk-add bkmk-add.py bkmk-chk bkmk-publish bkmk-rsync bkmk-sort bkmk2db \
Author: Oleg Broytman <phd@phdru.name>
-Copyright (C) 1997-2023 PhiloSoft Design.
+Copyright (C) 1997-2024 PhiloSoft Design.
License: GPL. For detailed terms see doc/COPYING.
--- /dev/null
+"""Robot based on requests
+
+This file is a part of Bookmarks database and Internet robot.
+
+"""
+
+__author__ = "Oleg Broytman <phd@phdru.name>"
+__copyright__ = "Copyright (C) 2024 PhiloSoft Design"
+__license__ = "GNU GPL"
+
+__all__ = ['robot_requests']
+
+
+import requests
+import requests_ftp
+
+from Robots.bkmk_robot_base import robot_base
+
+requests_ftp.monkeypatch_session()
+
+
+class robot_requests(robot_base):
+ def get(self, bookmark, url, accept_charset=False):
+ try:
+ r = requests.Session().get(
+ url, timeout=self.timeout, allow_redirects=False)
+ except requests.RequestException as e:
+ error = str(e)
+ self.log(' Error: %s' % error)
+ return error, None, None, None, None
+ else:
+ if r.is_redirect:
+ return None, r.status_code, r.next.url, None, None
+ return None, None, None, r.headers, r.content
+
+ def get_ftp_welcome(self):
+ return '' # Alas, requests_ftp doesn't store welcome message
if [ -z "$VIRTUAL_ENV" ]; then
test -d .venv && . .venv/bin/activate || {
- { python3 -m virtualenv .venv || python3 -m venv .venv; } &&
- . .venv/bin/activate &&
- pip install --compile --upgrade beautifulsoup4 lxml m_lib.full
+ { python3 -m virtualenv .venv || python3 -m venv .venv; } &&
+ . .venv/bin/activate &&
+ pip install --compile --upgrade beautifulsoup4 lxml m_lib.full \
+ requests requests-ftp
} || exit 1
fi
bookmarks.html.
WHAT'S NEW
+Version 5.1.0 (2024-03-01)
+
+ Robot based on requests.
+
Version 5.0.0 (2023-11-22)
Python 3.
git clone https://git.phdru.name/bookmarks_db.git
git clone git://git.phdru.name/bookmarks_db.git
- Requires: Python 2.7 or 3.4+, BeautifulSoup 4, lxml, m_lib 2.0+.
+ Requires: Python 2.7 or 3.4+, BeautifulSoup 4, lxml, m_lib 2.0+,
+ requests and requests-ftp.
AUTHOR
Oleg Broytman <phd@phdru.name>
COPYRIGHT
- Copyright (C) 1997-2023 PhiloSoft Design
+ Copyright (C) 1997-2024 PhiloSoft Design
LICENSE
GPL
+Version 5.1.0 (2024-03-01)
+
+ Robot based on requests.
+
Version 5.0.0 (2023-11-22)
Python 3.
-Robot based on requests.
-
Robot based on PycURL.
A program to publish bookmarks with icons.
"""
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 1997-2023 PhiloSoft Design"
+__copyright__ = "Copyright (C) 1997-2024 PhiloSoft Design"
__license__ = "GNU GPL"
__all__ = ['import_robot', 'robot']
from os import environ
from bkmk_objects import parse_params, set_params
-robot_name, robot_params = parse_params(environ.get("BKMK_ROBOT", "forking"))
+robot_name, robot_params = parse_params(environ.get("BKMK_ROBOT", "requests"))
def import_robot(robot_name):