File: __init__.py

package info (click to toggle)
python-scrapy 0.14.4-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,064 kB
  • sloc: python: 19,468; xml: 199; sh: 134; makefile: 67
file content (30 lines) | stat: -rw-r--r-- 860 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
XPath selectors

Two backends are currently available: libxml2 and lxml

To select the backend explicitly use the SELECTORS_BACKEND variable in your
project. Otherwise, libxml2 will be tried first. If libxml2 is not available,
lxml will be used.
"""

from scrapy.conf import settings

if settings['SELECTORS_BACKEND'] == 'lxml':
    from scrapy.selector.lxmlsel import *
elif settings['SELECTORS_BACKEND'] == 'libxml2':
    from scrapy.selector.libxml2sel import *
elif settings['SELECTORS_BACKEND'] == 'dummy':
    from scrapy.selector.dummysel import *
else:
    try:
        import libxml2
    except ImportError:
        try:
            import lxml
        except ImportError:
            from scrapy.selector.dummysel import *
        else:
            from scrapy.selector.lxmlsel import *
    else:
        from scrapy.selector.libxml2sel import *