Add a new bookmark. Parameters ---------- url : str URL to bookmark. title_in : str, optional Title to add manually. Default is None. tags_in : str, optional Comma-separated tags to add manually, instead of fetching them. D
(
self,
url: str,
title_in: Optional[str] = None,
tags_in: Optional[str] = None,
desc: Optional[str] = None,
immutable: bool = False,
delay_commit: bool = False,
fetch: bool = True,
url_redirect: bool = False,
tag_redirect: bool | str = False,
tag_error: bool | str = False,
del_error: Optional[IntSet] = None,
tags_fetch: bool = True,
tags_except: Optional[str] = None)
| 772 | self.cur.execute('VACUUM') |
| 773 | |
| 774 | def add_rec( |
| 775 | self, |
| 776 | url: str, |
| 777 | title_in: Optional[str] = None, |
| 778 | tags_in: Optional[str] = None, |
| 779 | desc: Optional[str] = None, |
| 780 | immutable: bool = False, |
| 781 | delay_commit: bool = False, |
| 782 | fetch: bool = True, |
| 783 | url_redirect: bool = False, |
| 784 | tag_redirect: bool | str = False, |
| 785 | tag_error: bool | str = False, |
| 786 | del_error: Optional[IntSet] = None, |
| 787 | tags_fetch: bool = True, |
| 788 | tags_except: Optional[str] = None) -> int: |
| 789 | """Add a new bookmark. |
| 790 | |
| 791 | Parameters |
| 792 | ---------- |
| 793 | url : str |
| 794 | URL to bookmark. |
| 795 | title_in : str, optional |
| 796 | Title to add manually. Default is None. |
| 797 | tags_in : str, optional |
| 798 | Comma-separated tags to add manually, instead of fetching them. Default is None. |
| 799 | tags_except : str, optional |
| 800 | These are removed from the resulting tags list. Default is None. |
| 801 | tags_fetch : bool |
| 802 | True if tags parsed from the fetched page should be included. Default is True. |
| 803 | desc : str, optional |
| 804 | Description of the bookmark. Default is None. |
| 805 | immutable : bool |
| 806 | Indicates whether to disable title fetch from web. Default is False. |
| 807 | delay_commit : bool |
| 808 | True if record should not be committed to the DB, |
| 809 | leaving commit responsibility to caller. Default is False. |
| 810 | fetch : bool |
| 811 | Fetch page from web and parse for data. Required fetch-status params to take effect. |
| 812 | url_redirect : bool |
| 813 | Bookmark the URL produced after following all PERMANENT redirects. |
| 814 | tag_redirect : bool | str |
| 815 | Adds a tag by the given pattern if the url resolved to a PERMANENT |
| 816 | redirect. (True means the default pattern 'http:{}'.) |
| 817 | tag_error : bool | str |
| 818 | Adds a tag by the given pattern if the url resolved to a HTTP error. |
| 819 | (True means the default pattern 'http:{}'.) |
| 820 | del_error : int{} | range, optional |
| 821 | Do not add the bookmark if HTTP response status is in the given set or range. |
| 822 | Also prevents the bookmark from being added on a network error. |
| 823 | |
| 824 | Returns |
| 825 | ------- |
| 826 | int |
| 827 | DB index of new bookmark on success, None on failure. |
| 828 | """ |
| 829 | |
| 830 | # Return error for empty URL |
| 831 | if not url: |