Remove the 'inspect' command
This commit is contained in:
parent
fe02de196b
commit
030197c738
1 changed files with 1 additions and 32 deletions
|
|
@ -108,7 +108,7 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
# Objects to allow in do_ls / do_cd
|
# Objects to allow in do_ls / do_cd
|
||||||
COLLECTION_OBJECTS = tuple()
|
COLLECTION_OBJECTS = tuple()
|
||||||
|
|
||||||
weboob_commands = set(['backends', 'condition', 'count', 'formatter', 'inspect', 'logging', 'select', 'quit', 'ls', 'cd'])
|
weboob_commands = set(['backends', 'condition', 'count', 'formatter', 'logging', 'select', 'quit', 'ls', 'cd'])
|
||||||
hidden_commands = set(['EOF'])
|
hidden_commands = set(['EOF'])
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
@ -945,37 +945,6 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
else:
|
else:
|
||||||
print(' '.join(self.selected_fields))
|
print(' '.join(self.selected_fields))
|
||||||
|
|
||||||
def complete_inspect(self, text, line, begidx, endidx):
|
|
||||||
return sorted(set(backend.name for backend in self.enabled_backends))
|
|
||||||
|
|
||||||
def do_inspect(self, line):
|
|
||||||
"""
|
|
||||||
inspect BACKEND_NAME
|
|
||||||
|
|
||||||
Display the HTML string of the current page of the specified backend's browser.
|
|
||||||
"""
|
|
||||||
if len(self.enabled_backends) == 1:
|
|
||||||
backend = list(self.enabled_backends)[0]
|
|
||||||
else:
|
|
||||||
backend_name = line.strip()
|
|
||||||
if not backend_name:
|
|
||||||
print('Please specify a backend name.', file=sys.stderr)
|
|
||||||
return 2
|
|
||||||
backends = set(backend for backend in self.enabled_backends if backend.name == backend_name)
|
|
||||||
if not backends:
|
|
||||||
print('No backend found for "%s"' % backend_name, file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
backend = backends.pop()
|
|
||||||
if not backend.browser:
|
|
||||||
print('No browser created for backend "%s".' % backend.name, file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
if not backend.browser.page:
|
|
||||||
print('The browser of %s is not on any page.' % backend.name, file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
browser = backend.browser
|
|
||||||
data = browser.parser.tostring(browser.page.document)
|
|
||||||
print(data)
|
|
||||||
|
|
||||||
# First sort in alphabetical of backend
|
# First sort in alphabetical of backend
|
||||||
# Second, sort with ID
|
# Second, sort with ID
|
||||||
def comp_object(self, obj1, obj2):
|
def comp_object(self, obj1, obj2):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue