mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: misc fixes to make all module import
This commit is contained in:
parent
a7f3fd798b
commit
b9a3e1952e
@ -374,9 +374,9 @@ class LRFMetaFile(object):
|
||||
return res
|
||||
return restore_pos
|
||||
locals_ = func()
|
||||
if locals_.has_key("fget"): # noqa
|
||||
if 'fget' in locals_:
|
||||
locals_["fget"] = decorator(locals_["fget"])
|
||||
if locals_.has_key("fset"): # noqa
|
||||
if 'fset' in locals_:
|
||||
locals_["fset"] = decorator(locals_["fset"])
|
||||
return property(**locals_)
|
||||
|
||||
|
@ -9,7 +9,7 @@ import io
|
||||
import codecs
|
||||
import os
|
||||
|
||||
from pylrfopt import tagListOptimizer
|
||||
from .pylrfopt import tagListOptimizer
|
||||
from polyglot.builtins import iteritems, string_or_bytes
|
||||
|
||||
PYLRF_VERSION = "1.0"
|
||||
|
@ -42,7 +42,7 @@ from xml.sax.saxutils import escape
|
||||
from datetime import date
|
||||
from xml.etree.ElementTree import Element, SubElement, ElementTree
|
||||
|
||||
from pylrf import (LrfWriter, LrfObject, LrfTag, LrfToc,
|
||||
from .pylrf import (LrfWriter, LrfObject, LrfTag, LrfToc,
|
||||
STREAM_COMPRESSED, LrfTagStream, LrfStreamBase, IMAGE_TYPE_ENCODING,
|
||||
BINDING_DIRECTION_ENCODING, LINE_TYPE_ENCODING, LrfFileStream,
|
||||
STREAM_FORCE_COMPRESSED)
|
||||
@ -1153,7 +1153,7 @@ class TextStyle(LrsStyle):
|
||||
"rubyadjust", "rubyalign", "rubyoverhang",
|
||||
"empdotsposition", 'emplinetype', 'emplineposition']
|
||||
|
||||
validSettings = baseDefaults.keys() + alsoAllow
|
||||
validSettings = list(baseDefaults) + alsoAllow
|
||||
|
||||
defaults = baseDefaults.copy()
|
||||
|
||||
@ -1214,7 +1214,7 @@ class PageStyle(LrsStyle):
|
||||
alsoAllow = ["header", "evenheader", "oddheader",
|
||||
"footer", "evenfooter", "oddfooter"]
|
||||
|
||||
validSettings = baseDefaults.keys() + alsoAllow
|
||||
validSettings = list(baseDefaults) + alsoAllow
|
||||
defaults = baseDefaults.copy()
|
||||
|
||||
@classmethod
|
||||
|
@ -14,13 +14,13 @@ from calibre.ebooks.metadata.book.base import Metadata
|
||||
from calibre import browser
|
||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||
from calibre.ebooks.chardet import xml_to_unicode
|
||||
from polyglot.builtins import codepoint_to_chr, unicode_type
|
||||
from polyglot.builtins import codepoint_to_chr, unicode_type, range
|
||||
from polyglot.urllib import parse_qs, quote_plus
|
||||
|
||||
URL = \
|
||||
"http://ww2.kdl.org/libcat/WhatsNext.asp?AuthorLastName={0}&AuthorFirstName=&SeriesName=&BookTitle={1}&CategoryID=0&cmdSearch=Search&Search=1&grouping="
|
||||
|
||||
_ignore_starts = u'\'"'+u''.join(codepoint_to_chr(x) for x in range(0x2018, 0x201e)+[0x2032, 0x2033])
|
||||
_ignore_starts = u'\'"'+u''.join(codepoint_to_chr(x) for x in list(range(0x2018, 0x201e))+[0x2032, 0x2033])
|
||||
|
||||
|
||||
def get_series(title, authors, timeout=60):
|
||||
|
@ -34,9 +34,9 @@ aid_able_tags = {'a', 'abbr', 'address', 'article', 'aside', 'audio', 'b',
|
||||
'span', 'strong', 'sub', 'summary', 'sup', 'textarea', 'time', 'ul', 'var',
|
||||
'video'}
|
||||
|
||||
_self_closing_pat = re.compile(bytes(
|
||||
_self_closing_pat = re.compile(
|
||||
r'<(?P<tag>%s)(?=[\s/])(?P<arg>[^>]*)/>'%('|'.join(aid_able_tags|{'script',
|
||||
'style', 'title', 'head'}))),
|
||||
'style', 'title', 'head'})).encode('ascii'),
|
||||
re.IGNORECASE)
|
||||
|
||||
|
||||
|
@ -4,15 +4,22 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from polyglot.builtins import range
|
||||
|
||||
|
||||
def r(*a):
|
||||
return list(range(*a))
|
||||
|
||||
|
||||
# Uncommon Characters supported by PML. \\a tag codes
|
||||
A_CHARS = range(160, 256) + range(130, 136) + range(138, 141) + \
|
||||
range(145, 152) + range(153, 157) + [159]
|
||||
A_CHARS = r(160, 256) + r(130, 136) + r(138, 141) + \
|
||||
r(145, 152) + r(153, 157) + [159]
|
||||
|
||||
# Extended Unicode characters supported by PML
|
||||
Latin_ExtendedA = range(0x0100, 0x0104) + [0x0105, 0x0107, 0x010C, 0x010D,
|
||||
Latin_ExtendedA = r(0x0100, 0x0104) + [0x0105, 0x0107, 0x010C, 0x010D,
|
||||
0x0112, 0x0113, 0x0115, 0x0117, 0x0119, 0x011B, 0x011D, 0x011F, 0x012A,
|
||||
0x012B, 0x012D, 0x012F, 0x0131, 0x0141, 0x0142, 0x0144, 0x0148] + \
|
||||
range(0x014B, 0x014E) + [0x014F, 0x0151, 0x0155] + range(0x0159, 0x015C) + \
|
||||
r(0x014B, 0x014E) + [0x014F, 0x0151, 0x0155] + r(0x0159, 0x015C) + \
|
||||
[0x015F, 0x0163, 0x0169, 0x016B, 0x016D, 0x0177, 0x017A, 0x017D, 0x017E]
|
||||
Latin_ExtendedB = [0x01BF, 0x01CE, 0x01D0, 0x01D2, 0x01D4, 0x01E1, 0x01E3,
|
||||
0x01E7, 0x01EB, 0x01F0, 0x0207, 0x021D, 0x0227, 0x022F, 0x0233]
|
||||
@ -20,23 +27,23 @@ IPA_Extensions = [0x0251, 0x0251, 0x0254, 0x0259, 0x025C, 0x0265, 0x026A,
|
||||
0x0272, 0x0283, 0x0289, 0x028A, 0x028C, 0x028F, 0x0292, 0x0294, 0x029C]
|
||||
Spacing_Modifier_Letters = [0x02BE, 0x02BF, 0x02C7, 0x02C8, 0x02CC, 0x02D0,
|
||||
0x02D8, 0x02D9]
|
||||
Greek_and_Coptic = range(0x0391, 0x03A2) + range(0x03A3, 0x03AA) + \
|
||||
range(0x03B1, 0x03CA) + [0x03D1, 0x03DD]
|
||||
Hebrew = range(0x05D0, 0x05EB)
|
||||
Greek_and_Coptic = r(0x0391, 0x03A2) + r(0x03A3, 0x03AA) + \
|
||||
r(0x03B1, 0x03CA) + [0x03D1, 0x03DD]
|
||||
Hebrew = r(0x05D0, 0x05EB)
|
||||
Latin_Extended_Additional = [0x1E0B, 0x1E0D, 0x1E17, 0x1E22, 0x1E24, 0x1E25,
|
||||
0x1E2B, 0x1E33, 0x1E37, 0x1E41, 0x1E43, 0x1E45, 0x1E47, 0x1E53] + \
|
||||
range(0x1E59, 0x1E5C) + [0x1E61, 0x1E63, 0x1E6B, 0x1E6D, 0x1E6F, 0x1E91,
|
||||
r(0x1E59, 0x1E5C) + [0x1E61, 0x1E63, 0x1E6B, 0x1E6D, 0x1E6F, 0x1E91,
|
||||
0x1E93, 0x1E96, 0x1EA1, 0x1ECD, 0x1EF9]
|
||||
General_Punctuation = [0x2011, 0x2038, 0x203D, 0x2042]
|
||||
Arrows = [0x2190, 0x2192]
|
||||
Mathematical_Operators = [0x2202, 0x221A, 0x221E, 0x2225, 0x222B, 0x2260,
|
||||
0x2294, 0x2295, 0x22EE]
|
||||
Enclosed_Alphanumerics = [0x24CA]
|
||||
Miscellaneous_Symbols = range(0x261C, 0x2641) + range(0x2642, 0x2648) + \
|
||||
range(0x2660, 0x2664) + range(0x266D, 0x2670)
|
||||
Miscellaneous_Symbols = r(0x261C, 0x2641) + r(0x2642, 0x2648) + \
|
||||
r(0x2660, 0x2664) + r(0x266D, 0x2670)
|
||||
Dingbats = [0x2713, 0x2720]
|
||||
Private_Use_Area = range(0xE000, 0xE01D) + range(0xE01E, 0xE029) + \
|
||||
range(0xE02A, 0xE052)
|
||||
Private_Use_Area = r(0xE000, 0xE01D) + r(0xE01E, 0xE029) + \
|
||||
r(0xE02A, 0xE052)
|
||||
Alphabetic_Presentation_Forms = [0xFB02, 0xFB2A, 0xFB2B]
|
||||
|
||||
# \\U tag codes.
|
||||
|
@ -156,7 +156,7 @@ class Document:
|
||||
continue # try again
|
||||
else:
|
||||
return cleaned_article
|
||||
except StandardError as e:
|
||||
except Exception as e:
|
||||
self.log.exception('error getting summary: ')
|
||||
reraise(Unparseable, Unparseable(str(e)), sys.exc_info()[2])
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from functions import textile, textile_restricted, Textile
|
||||
from .functions import textile, textile_restricted, Textile
|
||||
|
||||
if False:
|
||||
textile, textile_restricted, Textile
|
||||
|
@ -18,7 +18,7 @@ from calibre.utils.icu import sort_key
|
||||
from calibre.utils.localization import localize_user_manual_link
|
||||
from polyglot.builtins import unicode_type
|
||||
|
||||
from catalog_epub_mobi_ui import Ui_Form
|
||||
from .catalog_epub_mobi_ui import Ui_Form
|
||||
from PyQt5.Qt import (Qt, QAbstractItemView, QCheckBox, QComboBox,
|
||||
QDoubleSpinBox, QIcon, QInputDialog, QLineEdit, QRadioButton,
|
||||
QSize, QSizePolicy, QTableWidget, QTableWidgetItem, QTextEdit, QToolButton,
|
||||
|
@ -204,7 +204,7 @@
|
||||
<customwidget>
|
||||
<class>BookView</class>
|
||||
<extends>QGraphicsView</extends>
|
||||
<header>bookview.h</header>
|
||||
<header>calibre/gui2/lrf_renderer/bookview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
|
@ -127,7 +127,7 @@
|
||||
<customwidget>
|
||||
<class>ResultsView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>results_view.h</header>
|
||||
<header>calibre/gui2/store/config/chooser/results_view.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>HistoryLineEdit</class>
|
||||
|
@ -347,7 +347,7 @@
|
||||
<customwidget>
|
||||
<class>ResultsView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>results_view.h</header>
|
||||
<header>calibre/gui2/store/config/chooser/results_view.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>HistoryLineEdit2</class>
|
||||
|
@ -7,7 +7,10 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
store_version = 5 # Needed for dynamic plugin loading
|
||||
|
||||
from contextlib import closing
|
||||
import urllib
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -44,7 +47,7 @@ def search_amazon(query, max_results=10, timeout=60,
|
||||
x = x.encode('utf-8')
|
||||
return x
|
||||
uquery = {asbytes(k):asbytes(v) for k, v in uquery.items()}
|
||||
url = base_url + '?' + urllib.urlencode(uquery).decode('ascii')
|
||||
url = base_url + '?' + urlencode(uquery).decode('ascii')
|
||||
br = browser(user_agent=get_user_agent())
|
||||
|
||||
counter = max_results
|
||||
|
@ -7,7 +7,10 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
store_version = 7 # Needed for dynamic plugin loading
|
||||
|
||||
from contextlib import closing
|
||||
import urllib
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -44,7 +47,7 @@ def search_amazon(query, max_results=10, timeout=60,
|
||||
x = x.encode('utf-8')
|
||||
return x
|
||||
uquery = {asbytes(k):asbytes(v) for k, v in uquery.items()}
|
||||
url = base_url + '?' + urllib.urlencode(uquery).decode('ascii')
|
||||
url = base_url + '?' + urlencode(uquery).decode('ascii')
|
||||
br = browser(user_agent=get_user_agent())
|
||||
|
||||
counter = max_results
|
||||
|
@ -7,7 +7,10 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
store_version = 15 # Needed for dynamic plugin loading
|
||||
|
||||
from contextlib import closing
|
||||
import urllib
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -46,7 +49,7 @@ def search_amazon(query, max_results=10, timeout=60,
|
||||
x = x.encode('utf-8')
|
||||
return x
|
||||
uquery = {asbytes(k):asbytes(v) for k, v in uquery.items()}
|
||||
url = base_url + '?' + urllib.urlencode(uquery).decode('ascii')
|
||||
url = base_url + '?' + urlencode(uquery).decode('ascii')
|
||||
br = browser(user_agent=get_user_agent())
|
||||
|
||||
counter = max_results
|
||||
|
@ -7,7 +7,10 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
store_version = 15 # Needed for dynamic plugin loading
|
||||
|
||||
from contextlib import closing
|
||||
import urllib
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib2 import urlencode
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -46,7 +49,7 @@ def search_amazon(query, max_results=10, timeout=60,
|
||||
x = x.encode('utf-8')
|
||||
return x
|
||||
uquery = {asbytes(k):asbytes(v) for k, v in uquery.items()}
|
||||
url = base_url + '?' + urllib.urlencode(uquery).decode('ascii')
|
||||
url = base_url + '?' + urlencode(uquery).decode('ascii')
|
||||
br = browser(user_agent=get_user_agent())
|
||||
|
||||
counter = max_results
|
||||
|
@ -7,7 +7,10 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
store_version = 15 # Needed for dynamic plugin loading
|
||||
|
||||
from contextlib import closing
|
||||
import urllib
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -46,7 +49,7 @@ def search_amazon(query, max_results=10, timeout=60,
|
||||
x = x.encode('utf-8')
|
||||
return x
|
||||
uquery = {asbytes(k):asbytes(v) for k, v in uquery.items()}
|
||||
url = base_url + '?' + urllib.urlencode(uquery).decode('ascii')
|
||||
url = base_url + '?' + urlencode(uquery).decode('ascii')
|
||||
br = browser(user_agent=get_user_agent())
|
||||
|
||||
counter = max_results
|
||||
|
@ -7,7 +7,10 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
store_version = 5 # Needed for dynamic plugin loading
|
||||
|
||||
from contextlib import closing
|
||||
import urllib
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -44,7 +47,7 @@ def search_amazon(query, max_results=10, timeout=60,
|
||||
x = x.encode('utf-8')
|
||||
return x
|
||||
uquery = {asbytes(k):asbytes(v) for k, v in uquery.items()}
|
||||
url = base_url + '?' + urllib.urlencode(uquery).decode('ascii')
|
||||
url = base_url + '?' + urlencode(uquery).decode('ascii')
|
||||
br = browser(user_agent=get_user_agent())
|
||||
|
||||
counter = max_results
|
||||
|
@ -7,7 +7,10 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
store_version = 15 # Needed for dynamic plugin loading
|
||||
|
||||
from contextlib import closing
|
||||
import urllib
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -46,7 +49,7 @@ def search_amazon(query, max_results=10, timeout=60,
|
||||
x = x.encode('utf-8')
|
||||
return x
|
||||
uquery = {asbytes(k):asbytes(v) for k, v in uquery.items()}
|
||||
url = base_url + '?' + urllib.urlencode(uquery).decode('ascii')
|
||||
url = base_url + '?' + urlencode(uquery).decode('ascii')
|
||||
br = browser(user_agent=get_user_agent())
|
||||
|
||||
counter = max_results
|
||||
|
@ -7,7 +7,10 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
store_version = 16 # Needed for dynamic plugin loading
|
||||
|
||||
from contextlib import closing
|
||||
import urllib
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
|
||||
from lxml import html, etree
|
||||
|
||||
@ -44,7 +47,7 @@ def search_amazon(query, max_results=10, timeout=60,
|
||||
x = x.encode('utf-8')
|
||||
return x
|
||||
uquery = {asbytes(k):asbytes(v) for k, v in uquery.items()}
|
||||
url = base_url + '?' + urllib.urlencode(uquery).decode('ascii')
|
||||
url = base_url + '?' + urlencode(uquery).decode('ascii')
|
||||
br = browser(user_agent=get_user_agent())
|
||||
|
||||
counter = max_results
|
||||
|
@ -7,7 +7,10 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
store_version = 15 # Needed for dynamic plugin loading
|
||||
|
||||
from contextlib import closing
|
||||
import urllib
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -44,7 +47,7 @@ def search_amazon(query, max_results=10, timeout=60,
|
||||
x = x.encode('utf-8')
|
||||
return x
|
||||
uquery = {asbytes(k):asbytes(v) for k, v in uquery.items()}
|
||||
url = base_url + '?' + urllib.urlencode(uquery).decode('ascii')
|
||||
url = base_url + '?' + urlencode(uquery).decode('ascii')
|
||||
br = browser(user_agent=get_user_agent())
|
||||
|
||||
counter = max_results
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from urllib import urlencode
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
|
||||
from lxml import html
|
||||
|
||||
|
@ -7,7 +7,10 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib2
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib2 import quote
|
||||
from contextlib import closing
|
||||
|
||||
from lxml import html
|
||||
@ -41,7 +44,7 @@ class BeamEBooksDEStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'https://www.beam-shop.de/search?saltFieldLimitation=all&sSearch=' + urllib2.quote(query)
|
||||
url = 'https://www.beam-shop.de/search?saltFieldLimitation=all&sSearch=' + quote(query)
|
||||
br = browser()
|
||||
|
||||
counter = max_results
|
||||
|
@ -8,8 +8,11 @@ __copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -37,7 +40,7 @@ class BNStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'http://www.barnesandnoble.com/s/%s?keyword=%s&store=ebook&view=list' % (query.replace(' ', '-'), urllib.quote_plus(query))
|
||||
url = 'http://www.barnesandnoble.com/s/%s?keyword=%s&store=ebook&view=list' % (query.replace(' ', '-'), quote_plus(query))
|
||||
|
||||
br = browser()
|
||||
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2014, Rafael Vega <rafavega@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -35,7 +38,7 @@ class BubokPortugalStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'http://www.bubok.pt/resellers/calibre_search/' + urllib.quote_plus(query)
|
||||
url = 'http://www.bubok.pt/resellers/calibre_search/' + quote_plus(query)
|
||||
|
||||
br = browser()
|
||||
|
||||
@ -72,4 +75,3 @@ class BubokPortugalStore(BasicStoreConfig, StorePlugin):
|
||||
|
||||
def get_details(self, search_result, timeout):
|
||||
return True
|
||||
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2014, Rafael Vega <rafavega@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -35,7 +38,7 @@ class BubokPublishingStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'http://www.bubok.es/resellers/calibre_search/' + urllib.quote_plus(query)
|
||||
url = 'http://www.bubok.es/resellers/calibre_search/' + quote_plus(query)
|
||||
|
||||
br = browser()
|
||||
|
||||
@ -72,4 +75,3 @@ class BubokPublishingStore(BasicStoreConfig, StorePlugin):
|
||||
|
||||
def get_details(self, search_result, timeout):
|
||||
return True
|
||||
|
||||
|
@ -8,8 +8,12 @@ __copyright__ = '2011, Alex Stanev <alex@stanev.org>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import urllib2
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
from urllib.error import HTTPError
|
||||
except ImportError:
|
||||
from urllib import quote, HTTPError
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -51,7 +55,7 @@ class ChitankaStore(BasicStoreConfig, StorePlugin):
|
||||
return
|
||||
|
||||
base_url = 'http://chitanka.info'
|
||||
url = base_url + '/search?q=' + urllib2.quote(query)
|
||||
url = base_url + '/search?q=' + quote(query)
|
||||
counter = max_results
|
||||
|
||||
# search for book title
|
||||
@ -82,7 +86,7 @@ class ChitankaStore(BasicStoreConfig, StorePlugin):
|
||||
s.downloads['TXT'] = base_url + ''.join(data.xpath('.//a[@class="dl dl-txt"]/@href')).strip().replace('.zip', '')
|
||||
s.formats = 'FB2, EPUB, TXT, SFB'
|
||||
yield s
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
if e.code == 404:
|
||||
return
|
||||
else:
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib2
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -42,7 +45,7 @@ class EBookNLStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = ('http://www.ebook.nl/store/advanced_search_result.php?keywords=' + urllib2.quote(query))
|
||||
url = ('http://www.ebook.nl/store/advanced_search_result.php?keywords=' + quote(query))
|
||||
br = browser()
|
||||
|
||||
counter = max_results
|
||||
|
@ -8,9 +8,12 @@ __copyright__ = '2011-2016, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import urllib
|
||||
from base64 import b64encode
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -55,7 +58,7 @@ class EbookpointStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=25, timeout=60):
|
||||
url = 'http://ebookpoint.pl/search?qa=&szukaj=' + urllib.quote_plus(
|
||||
url = 'http://ebookpoint.pl/search?qa=&szukaj=' + quote_plus(
|
||||
query.decode('utf-8').encode('iso-8859-2')) + '&serwisyall=0&wprzyg=0&wsprzed=1&wyczerp=0&formaty=em-p'
|
||||
|
||||
br = browser()
|
||||
|
@ -8,8 +8,11 @@ __copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -44,7 +47,7 @@ class EbookscomStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'http://www.ebooks.com/SearchApp/SearchResults.net?term=' + urllib.quote_plus(query)
|
||||
url = 'http://www.ebooks.com/SearchApp/SearchResults.net?term=' + quote_plus(query)
|
||||
|
||||
br = browser()
|
||||
|
||||
@ -56,7 +59,7 @@ class EbookscomStore(BasicStoreConfig, StorePlugin):
|
||||
break
|
||||
|
||||
id = ''.join(data.xpath('.//a[1]/@href'))
|
||||
mo = re.search('\d+', id)
|
||||
mo = re.search(r'\d+', id)
|
||||
if not mo:
|
||||
continue
|
||||
id = mo.group()
|
||||
|
@ -7,7 +7,10 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib2
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib2 import quote
|
||||
from contextlib import closing
|
||||
|
||||
from lxml import html
|
||||
@ -42,7 +45,7 @@ class EBookShoppeUKStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'http://www.ebookshoppe.com/search.php?search_query=' + urllib2.quote(query)
|
||||
url = 'http://www.ebookshoppe.com/search.php?search_query=' + quote(query)
|
||||
br = browser()
|
||||
br.addheaders = [("Referer", "http://www.ebookshoppe.com/")]
|
||||
|
||||
|
@ -9,8 +9,11 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import random
|
||||
import urllib2
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -55,7 +58,7 @@ class eKnigiStore(BasicStoreConfig, StorePlugin):
|
||||
return
|
||||
|
||||
base_url = 'http://e-knigi.net'
|
||||
url = base_url + '/virtuemart?page=shop.browse&search_category=0&search_limiter=anywhere&keyword=' + urllib2.quote(query)
|
||||
url = base_url + '/virtuemart?page=shop.browse&search_category=0&search_limiter=anywhere&keyword=' + quote(query)
|
||||
|
||||
br = browser()
|
||||
|
||||
|
@ -8,9 +8,12 @@ __copyright__ = '2011-2017, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import urllib
|
||||
from base64 import b64encode
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -55,7 +58,7 @@ class EmpikStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'http://www.empik.com/ebooki/ebooki,3501,s?resultsPP=' + str(max_results) + '&q=' + urllib.quote(query)
|
||||
url = 'http://www.empik.com/ebooki/ebooki,3501,s?resultsPP=' + str(max_results) + '&q=' + quote(query)
|
||||
|
||||
br = browser()
|
||||
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html
|
||||
from PyQt5.Qt import QUrl
|
||||
@ -33,7 +36,7 @@ def parse_html(raw):
|
||||
|
||||
|
||||
def search_google(query, max_results=10, timeout=60, write_html_to=None):
|
||||
url = 'https://www.google.com/search?tbm=bks&q=' + urllib.quote_plus(query)
|
||||
url = 'https://www.google.com/search?tbm=bks&q=' + quote_plus(query)
|
||||
|
||||
br = browser()
|
||||
|
||||
|
@ -10,8 +10,11 @@ __docformat__ = 'restructuredtext en'
|
||||
import base64
|
||||
import mimetypes
|
||||
import re
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import etree
|
||||
|
||||
@ -31,7 +34,7 @@ def fix_url(url):
|
||||
|
||||
|
||||
def search(query, max_results=10, timeout=60, write_raw_to=None):
|
||||
url = 'http://m.gutenberg.org/ebooks/search.opds/?query=' + urllib.quote_plus(query)
|
||||
url = 'http://m.gutenberg.org/ebooks/search.opds/?query=' + quote_plus(query)
|
||||
|
||||
counter = max_results
|
||||
br = browser(user_agent='calibre/'+__version__)
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html, etree
|
||||
|
||||
@ -23,7 +26,7 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
|
||||
|
||||
def search_kobo(query, max_results=10, timeout=60, write_html_to=None):
|
||||
from css_selectors import Select
|
||||
url = 'https://www.kobobooks.com/search/search.html?q=' + urllib.quote_plus(query)
|
||||
url = 'https://www.kobobooks.com/search/search.html?q=' + quote_plus(query)
|
||||
|
||||
br = browser()
|
||||
|
||||
@ -89,7 +92,7 @@ class KoboStore(BasicStoreConfig, StorePlugin):
|
||||
murl = 'https://click.linksynergy.com/fs-bin/click?id=%s&subid=&offerid=280046.1&type=10&tmpid=9310&RD_PARM1=http%%3A%%2F%%2Fkobo.com' % pub_id
|
||||
|
||||
if detail_item:
|
||||
purl = 'https://click.linksynergy.com/link?id=%s&offerid=280046&type=2&murl=%s' % (pub_id, urllib.quote_plus(detail_item))
|
||||
purl = 'https://click.linksynergy.com/link?id=%s&offerid=280046&type=2&murl=%s' % (pub_id, quote_plus(detail_item))
|
||||
url = purl
|
||||
else:
|
||||
purl = None
|
||||
|
@ -8,9 +8,12 @@ __copyright__ = '2011-2017, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import urllib
|
||||
from base64 import b64encode
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -55,7 +58,7 @@ class LegimiStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'https://www.legimi.pl/ebooki/?szukaj=' + urllib.quote_plus(query)
|
||||
url = 'https://www.legimi.pl/ebooki/?szukaj=' + quote_plus(query)
|
||||
|
||||
br = browser()
|
||||
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib2
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -43,7 +46,7 @@ class LibreDEStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = ('http://www.ebook.de/de/pathSearch?nav=52122&searchString=' + urllib2.quote(query))
|
||||
url = ('http://www.ebook.de/de/pathSearch?nav=52122&searchString=' + quote(query))
|
||||
br = browser()
|
||||
|
||||
counter = max_results
|
||||
|
@ -9,7 +9,10 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import random
|
||||
import re
|
||||
import urllib2
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
from contextlib import closing
|
||||
from lxml import etree
|
||||
@ -37,7 +40,7 @@ class LitResStore(BasicStoreConfig, StorePlugin):
|
||||
if detail_item:
|
||||
# http://www.litres.ru/pages/biblio_book/?art=157074
|
||||
detail_url = self.shop_url + u'/pages/biblio_book/' + aff_id +\
|
||||
u'&art=' + urllib2.quote(detail_item)
|
||||
u'&art=' + quote(detail_item)
|
||||
|
||||
if external or self.config.get('open_external', False):
|
||||
open_url(QUrl(url_slash_cleaner(detail_url if detail_url else url)))
|
||||
@ -50,7 +53,7 @@ class LitResStore(BasicStoreConfig, StorePlugin):
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
search_url = u'http://robot.litres.ru/pages/catalit_browser/?checkpoint=2000-01-02&'\
|
||||
'search=%s&limit=0,%s'
|
||||
search_url = search_url % (urllib2.quote(query), max_results)
|
||||
search_url = search_url % (quote(query), max_results)
|
||||
|
||||
counter = max_results
|
||||
br = browser()
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib2
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -43,7 +46,7 @@ class MillsBoonUKStore(BasicStoreConfig, StorePlugin):
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
base_url = 'https://www.millsandboon.co.uk'
|
||||
url = base_url + '/search.aspx??format=ebook&searchText=' + urllib2.quote(query)
|
||||
url = base_url + '/search.aspx??format=ebook&searchText=' + quote(query)
|
||||
br = browser()
|
||||
|
||||
counter = max_results
|
||||
|
@ -8,8 +8,11 @@ __copyright__ = '2011-2016, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -46,7 +49,7 @@ class NextoStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'http://www.nexto.pl/szukaj.xml?search-clause=' + urllib.quote_plus(query) + '&scid=1015'
|
||||
url = 'http://www.nexto.pl/szukaj.xml?search-clause=' + quote_plus(query) + '&scid=1015'
|
||||
|
||||
br = browser()
|
||||
offset=0
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -36,7 +39,7 @@ class OpenBooksStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'https://drmfree.calibre-ebook.com/search/?q=' + urllib.quote_plus(query)
|
||||
url = 'https://drmfree.calibre-ebook.com/search/?q=' + quote_plus(query)
|
||||
|
||||
br = browser()
|
||||
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011-2013, Roman Mukhin <ramses_ru at hotmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from PyQt5.Qt import QUrl
|
||||
|
||||
@ -34,7 +37,7 @@ def parse_html(raw):
|
||||
|
||||
|
||||
def search(query, max_results=15, timeout=60):
|
||||
url = 'http://www.ozon.ru/?context=search&text=%s&store=1,0&group=div_book' % urllib.quote_plus(query)
|
||||
url = 'http://www.ozon.ru/?context=search&text=%s&store=1,0&group=div_book' % quote_plus(query)
|
||||
|
||||
counter = max_results
|
||||
br = browser()
|
||||
|
@ -7,7 +7,10 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2012-2017, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
from base64 import b64encode
|
||||
from contextlib import closing
|
||||
|
||||
@ -59,7 +62,7 @@ class PublioStore(BasicStoreConfig, StorePlugin):
|
||||
counter = max_results
|
||||
page = 1
|
||||
while counter:
|
||||
with closing(br.open('http://www.publio.pl/e-booki,strona' + str(page) + '.html?q=' + urllib.quote(query), timeout=timeout)) as f: # noqa
|
||||
with closing(br.open('http://www.publio.pl/e-booki,strona' + str(page) + '.html?q=' + quote(query), timeout=timeout)) as f: # noqa
|
||||
doc = html.fromstring(f.read())
|
||||
for data in doc.xpath('//div[@class="products-list"]//div[@class="product-tile"]'):
|
||||
if counter <= 0:
|
||||
|
@ -8,8 +8,11 @@ __copyright__ = '2011, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import urlencode
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -46,7 +49,7 @@ class RW2010Store(BasicStoreConfig, StorePlugin):
|
||||
br = browser()
|
||||
|
||||
counter = max_results
|
||||
with closing(br.open(url, data=urllib.urlencode(values), timeout=timeout)) as f:
|
||||
with closing(br.open(url, data=urlencode(values), timeout=timeout)) as f:
|
||||
doc = html.fromstring(f.read())
|
||||
for data in doc.xpath('//div[@class="ProductDetail"]'):
|
||||
if counter <= 0:
|
||||
|
@ -9,8 +9,11 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import random
|
||||
import re
|
||||
import urllib2
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -25,7 +28,7 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
|
||||
|
||||
|
||||
def search(query, max_results=10, timeout=60):
|
||||
url = 'https://www.smashwords.com/books/search?query=' + urllib2.quote(query)
|
||||
url = 'https://www.smashwords.com/books/search?query=' + quote(query)
|
||||
|
||||
br = browser()
|
||||
try:
|
||||
|
@ -7,9 +7,12 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2017, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from base64 import b64encode
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -60,7 +63,7 @@ class SwiatEbookowStore(BasicStoreConfig, StorePlugin):
|
||||
|
||||
counter = max_results
|
||||
while counter:
|
||||
with closing(br.open('https://www.swiatebookow.pl/ebooki/?q=' + urllib.quote(query) + '&page=' + str(page), timeout=timeout)) as f:
|
||||
with closing(br.open('https://www.swiatebookow.pl/ebooki/?q=' + quote(query) + '&page=' + str(page), timeout=timeout)) as f:
|
||||
doc = html.fromstring(f.read().decode('utf-8'))
|
||||
for data in doc.xpath('//div[@class="category-item-container"]//div[@class="book-large"]'):
|
||||
if counter <= 0:
|
||||
|
@ -8,9 +8,12 @@ __copyright__ = '2011-2017, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
import urllib
|
||||
from base64 import b64encode
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -55,7 +58,7 @@ class VirtualoStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=12, timeout=60):
|
||||
url = 'http://virtualo.pl/?q=' + urllib.quote(query)
|
||||
url = 'http://virtualo.pl/?q=' + quote(query)
|
||||
|
||||
br = browser()
|
||||
no_drm_pattern = re.compile(r'Watermark|Brak')
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib2 import quote_plus
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -36,7 +39,7 @@ class WeightlessBooksStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'http://weightlessbooks.com/?s=' + urllib.quote_plus(query)
|
||||
url = 'http://weightlessbooks.com/?s=' + quote_plus(query)
|
||||
|
||||
br = browser()
|
||||
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib2
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote
|
||||
except ImportError:
|
||||
from urllib import quote
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -43,7 +46,7 @@ class WHSmithUKStore(BasicStoreConfig, StorePlugin):
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = ('http://www.whsmith.co.uk/search?keywordCategoryId=wc_dept_ebooks&results=60'
|
||||
'&page=1&keywords=' + urllib2.quote(query))
|
||||
'&page=1&keywords=' + quote(query))
|
||||
|
||||
br = browser()
|
||||
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011-2017, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from base64 import b64encode
|
||||
try:
|
||||
from urllib.parse import urlencode, quote_plus
|
||||
except ImportError:
|
||||
from urllib import urlencode, quote_plus
|
||||
|
||||
from lxml import html
|
||||
from mechanize import Request
|
||||
@ -33,7 +36,7 @@ def as_base64(data):
|
||||
|
||||
|
||||
def search(query, max_results=10, timeout=60):
|
||||
url = 'http://woblink.com/publication/ajax?mode=none&query=' + urllib.quote_plus(query.encode('utf-8'))
|
||||
url = 'http://woblink.com/publication/ajax?mode=none&query=' + quote_plus(query.encode('utf-8'))
|
||||
if max_results > 10:
|
||||
if max_results > 20:
|
||||
url += '&limit=30'
|
||||
@ -46,7 +49,7 @@ def search(query, max_results=10, timeout=60):
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Referrer':'http://woblink.com/ebooki-kategorie',
|
||||
'Cache-Control':'max-age=0',
|
||||
}, data=urllib.urlencode({
|
||||
}, data=urlencode({
|
||||
'nw_filtry_filtr_zakrescen_formularz[min]':'0',
|
||||
'nw_filtry_filtr_zakrescen_formularz[max]':'350',
|
||||
}))
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2012-2014, Tomasz Długosz <tomek3d@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import html
|
||||
|
||||
@ -41,7 +44,7 @@ class WolneLekturyStore(BasicStoreConfig, StorePlugin):
|
||||
d.exec_()
|
||||
|
||||
def search(self, query, max_results=10, timeout=60):
|
||||
url = 'http://wolnelektury.pl/szukaj?q=' + urllib.quote_plus(query.encode('utf-8'))
|
||||
url = 'http://wolnelektury.pl/szukaj?q=' + quote_plus(query.encode('utf-8'))
|
||||
|
||||
br = browser()
|
||||
|
||||
|
@ -7,8 +7,11 @@ __license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import urllib
|
||||
from contextlib import closing
|
||||
try:
|
||||
from urllib.parse import quote_plus
|
||||
except ImportError:
|
||||
from urllib import quote_plus
|
||||
|
||||
from lxml import etree
|
||||
|
||||
@ -39,7 +42,7 @@ class XinXiiStore(BasicStoreConfig, OpenSearchOPDSStore):
|
||||
function so this one is modified to remove parts that are used.
|
||||
'''
|
||||
|
||||
url = 'http://www.xinxii.com/catalog-search/query/?keywords=' + urllib.quote_plus(query)
|
||||
url = 'http://www.xinxii.com/catalog-search/query/?keywords=' + quote_plus(query)
|
||||
|
||||
counter = max_results
|
||||
br = browser()
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import ANIMNS
|
||||
from element import Element
|
||||
from .namespaces import ANIMNS
|
||||
from .element import Element
|
||||
|
||||
|
||||
# Autogenerated
|
||||
@ -58,4 +58,3 @@ def Set(**args):
|
||||
|
||||
def Transitionfilter(**args):
|
||||
return Element(qname = (ANIMNS,'transitionFilter'), **args)
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
from namespaces import *
|
||||
from .namespaces import *
|
||||
import re, types
|
||||
|
||||
pattern_color = re.compile(r'#[0-9a-fA-F]{6}')
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import CHARTNS
|
||||
from element import Element
|
||||
from .namespaces import CHARTNS
|
||||
from .element import Element
|
||||
|
||||
# Autogenerated
|
||||
def Axis(**args):
|
||||
@ -84,4 +84,3 @@ def Title(**args):
|
||||
|
||||
def Wall(**args):
|
||||
return Element(qname = (CHARTNS,'wall'), **args)
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import CONFIGNS
|
||||
from element import Element
|
||||
from .namespaces import CONFIGNS
|
||||
from .element import Element
|
||||
|
||||
# Autogenerated
|
||||
def ConfigItem(**args):
|
||||
@ -36,4 +36,3 @@ def ConfigItemMapNamed(**args):
|
||||
|
||||
def ConfigItemSet(**args):
|
||||
return Element(qname = (CONFIGNS, 'config-item-set'), **args)
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import DCNS
|
||||
from element import Element
|
||||
from .namespaces import DCNS
|
||||
from .element import Element
|
||||
|
||||
# Autogenerated
|
||||
def Creator(**args):
|
||||
|
@ -18,9 +18,9 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import DR3DNS
|
||||
from element import Element
|
||||
from draw import StyleRefElement
|
||||
from .namespaces import DR3DNS
|
||||
from .element import Element
|
||||
from .draw import StyleRefElement
|
||||
|
||||
# Autogenerated
|
||||
def Cube(**args):
|
||||
@ -40,4 +40,3 @@ def Scene(**args):
|
||||
|
||||
def Sphere(**args):
|
||||
return StyleRefElement(qname = (DR3DNS,'sphere'), **args)
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import DRAWNS, STYLENS, PRESENTATIONNS
|
||||
from element import Element
|
||||
from .namespaces import DRAWNS, STYLENS, PRESENTATIONNS
|
||||
from .element import Element
|
||||
|
||||
def StyleRefElement(stylename=None, classnames=None, **args):
|
||||
qattrs = {}
|
||||
|
@ -24,9 +24,9 @@
|
||||
#
|
||||
import xml.dom
|
||||
from xml.dom.minicompat import *
|
||||
from namespaces import nsdict
|
||||
import grammar
|
||||
from attrconverters import AttrConverters
|
||||
from .namespaces import nsdict
|
||||
from . import grammar
|
||||
from .attrconverters import AttrConverters
|
||||
|
||||
# The following code is pasted form xml.sax.saxutils
|
||||
# Tt makes it possible to run the code without the xml sax package installed
|
||||
@ -80,9 +80,9 @@ def _nsassign(namespace):
|
||||
return nsdict.setdefault(namespace,"ns" + str(len(nsdict)))
|
||||
|
||||
# Exceptions
|
||||
class IllegalChild(StandardError):
|
||||
class IllegalChild(Exception):
|
||||
""" Complains if you add an element to a parent where it is not allowed """
|
||||
class IllegalText(StandardError):
|
||||
class IllegalText(Exception):
|
||||
""" Complains if you add text or cdata to an element where it is not allowed """
|
||||
|
||||
class Node(xml.dom.Node):
|
||||
@ -255,7 +255,7 @@ class Text(Childless, Node):
|
||||
if self.data:
|
||||
f.write(_escape(type(u'')(self.data).encode('utf-8')))
|
||||
|
||||
class CDATASection(Childless, Text):
|
||||
class CDATASection(Text, Childless):
|
||||
nodeType = Node.CDATA_SECTION_NODE
|
||||
|
||||
def toXml(self,level,f):
|
||||
|
@ -19,7 +19,7 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import *
|
||||
from .namespaces import *
|
||||
|
||||
# Inline element don't cause a box
|
||||
# They are analogous to the HTML elements SPAN, B, I etc.
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import FORMNS
|
||||
from element import Element
|
||||
from .namespaces import FORMNS
|
||||
from .element import Element
|
||||
|
||||
|
||||
# Autogenerated
|
||||
|
@ -23,7 +23,7 @@ Currently it contains the legal child elements of a given element.
|
||||
To be used for validation check in the API
|
||||
"""
|
||||
|
||||
from namespaces import *
|
||||
from .namespaces import *
|
||||
|
||||
# The following code is generated from the RelaxNG schema with this notice:
|
||||
|
||||
|
@ -26,8 +26,8 @@
|
||||
|
||||
from __future__ import print_function
|
||||
from xml.sax import handler
|
||||
from element import Element
|
||||
from namespaces import OFFICENS
|
||||
from .element import Element
|
||||
from .namespaces import OFFICENS
|
||||
|
||||
#
|
||||
# Parse the XML files
|
||||
|
@ -20,8 +20,8 @@
|
||||
#
|
||||
#
|
||||
|
||||
from namespaces import MANIFESTNS
|
||||
from element import Element
|
||||
from .namespaces import MANIFESTNS
|
||||
from .element import Element
|
||||
|
||||
# Autogenerated
|
||||
def Manifest(**args):
|
||||
@ -38,4 +38,3 @@ def Algorithm(**args):
|
||||
|
||||
def KeyDerivation(**args):
|
||||
return Element(qname = (MANIFESTNS,'key-derivation'), **args)
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import MATHNS
|
||||
from element import Element
|
||||
from .namespaces import MATHNS
|
||||
from .element import Element
|
||||
|
||||
# ODF 1.0 section 12.5
|
||||
# Mathematical content is represented by MathML 2.0
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import METANS
|
||||
from element import Element
|
||||
from .namespaces import METANS
|
||||
from .element import Element
|
||||
|
||||
# Autogenerated
|
||||
def AutoReload(**args):
|
||||
|
@ -18,9 +18,9 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import NUMBERNS
|
||||
from element import Element
|
||||
from style import StyleElement
|
||||
from .namespaces import NUMBERNS
|
||||
from .element import Element
|
||||
from .style import StyleElement
|
||||
|
||||
|
||||
# Autogenerated
|
||||
@ -101,4 +101,3 @@ def WeekOfYear(**args):
|
||||
|
||||
def Year(**args):
|
||||
return Element(qname = (NUMBERNS,'year'), **args)
|
||||
|
||||
|
@ -20,9 +20,9 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
import sys, zipfile, xml.dom.minidom
|
||||
from namespaces import nsdict
|
||||
from elementtypes import *
|
||||
import zipfile, xml.dom.minidom
|
||||
from .namespaces import nsdict
|
||||
from .elementtypes import *
|
||||
|
||||
IGNORED_TAGS = [
|
||||
'draw:a'
|
||||
|
@ -25,9 +25,9 @@ from xml.sax import handler
|
||||
from xml.sax.saxutils import escape, quoteattr
|
||||
from xml.dom import Node
|
||||
|
||||
from opendocument import load
|
||||
from .opendocument import load
|
||||
|
||||
from namespaces import ANIMNS, CHARTNS, CONFIGNS, DCNS, DR3DNS, DRAWNS, FONS, \
|
||||
from .namespaces import ANIMNS, CHARTNS, CONFIGNS, DCNS, DR3DNS, DRAWNS, FONS, \
|
||||
FORMNS, MATHNS, METANS, NUMBERNS, OFFICENS, PRESENTATIONNS, SCRIPTNS, \
|
||||
SMILNS, STYLENS, SVGNS, TABLENS, TEXTNS, XLINKNS
|
||||
|
||||
|
@ -18,9 +18,9 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import OFFICENS
|
||||
from element import Element
|
||||
from draw import StyleRefElement
|
||||
from .namespaces import OFFICENS
|
||||
from .element import Element
|
||||
from .draw import StyleRefElement
|
||||
|
||||
# Autogenerated
|
||||
def Annotation(**args):
|
||||
|
@ -20,15 +20,13 @@
|
||||
|
||||
__doc__="""Use OpenDocument to generate your documents."""
|
||||
|
||||
import zipfile, time, sys, mimetypes, copy
|
||||
from cStringIO import StringIO
|
||||
from namespaces import *
|
||||
import manifest, meta
|
||||
from office import *
|
||||
import element
|
||||
from attrconverters import make_NCName
|
||||
import zipfile, time, sys, mimetypes
|
||||
from .namespaces import *
|
||||
from . import manifest, meta, element
|
||||
from .office import *
|
||||
from .attrconverters import make_NCName
|
||||
from xml.sax.xmlreader import InputSource
|
||||
from odfmanifest import manifestlist
|
||||
from .odfmanifest import manifestlist
|
||||
from polyglot.io import PolyglotBytesIO
|
||||
|
||||
__version__= TOOLSVERSION
|
||||
@ -177,7 +175,7 @@ class OpenDocument:
|
||||
""" Generates the content.xml file
|
||||
Always written as a bytestream in UTF-8 encoding
|
||||
"""
|
||||
xml=StringIO()
|
||||
xml=PolyglotBytesIO()
|
||||
xml.write(_XMLPROLOGUE)
|
||||
x = DocumentContent()
|
||||
x.write_open_tag(0, xml)
|
||||
@ -202,7 +200,7 @@ class OpenDocument:
|
||||
""" Generates the manifest.xml file
|
||||
The self.manifest isn't avaible unless the document is being saved
|
||||
"""
|
||||
xml=StringIO()
|
||||
xml=PolyglotBytesIO()
|
||||
xml.write(_XMLPROLOGUE)
|
||||
self.manifest.toXml(0,xml)
|
||||
return xml.getvalue()
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import PRESENTATIONNS
|
||||
from element import Element
|
||||
from .namespaces import PRESENTATIONNS
|
||||
from .element import Element
|
||||
|
||||
# ODF 1.0 section 9.6 and 9.7
|
||||
# Autogenerated
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import SCRIPTNS
|
||||
from element import Element
|
||||
from .namespaces import SCRIPTNS
|
||||
from .element import Element
|
||||
|
||||
# ODF 1.0 section 12.4.1
|
||||
# The <script:event-listener> element binds an event to a macro.
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import STYLENS
|
||||
from element import Element
|
||||
from .namespaces import STYLENS
|
||||
from .element import Element
|
||||
|
||||
def StyleElement(**args):
|
||||
e = Element(**args)
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import SVGNS
|
||||
from element import Element
|
||||
from .namespaces import SVGNS
|
||||
from .element import Element
|
||||
from draw import DrawElement
|
||||
|
||||
# Autogenerated
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import TABLENS
|
||||
from element import Element
|
||||
from .namespaces import TABLENS
|
||||
from .element import Element
|
||||
|
||||
|
||||
# Autogenerated
|
||||
|
@ -18,9 +18,9 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import TEXTNS
|
||||
from element import Element
|
||||
from style import StyleElement
|
||||
from .namespaces import TEXTNS
|
||||
from .element import Element
|
||||
from .style import StyleElement
|
||||
|
||||
# Autogenerated
|
||||
def A(**args):
|
||||
@ -559,4 +559,3 @@ def VariableSet(**args):
|
||||
|
||||
def WordCount(**args):
|
||||
return Element(qname = (TEXTNS,'word-count'), **args)
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
from namespaces import XFORMSNS
|
||||
from element import Element
|
||||
from .namespaces import XFORMSNS
|
||||
from .element import Element
|
||||
|
||||
# ODF 1.0 section 11.2
|
||||
# XForms is designed to be embedded in another XML format.
|
||||
|
Loading…
x
Reference in New Issue
Block a user