module simple_server.html_script_parser
¶
Short summary¶
module pyrsslocal.simple_server.html_script_parser
This modules contains a class which implements a simple server.
Classes¶
class |
truncated documentation |
---|---|
Defines a HTML parser. the purpose is to intercept section such as the following and to run it. |
|
Defines a HTML parser. the purpose is to remove the HTML code and the header |
Methods¶
method |
truncated documentation |
---|---|
Intercepts the data between two tags. |
|
Intercepts the data between two tags. |
|
Intercepts the end of a tag. |
|
Intercepts the end of a tag. |
|
Intercepts the beginning of a tag. |
|
Intercepts the beginning of a tag. |
|
Returns a string including the parameters values. |
|
Returns a string including the parameters values. |
Documentation¶
This modules contains a class which implements a simple server.
- class pyrsslocal.simple_server.html_script_parser.HTMLScriptParser(outStream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, context=None, catch_exception=False)¶
Bases:
HTMLParser
Defines a HTML parser. the purpose is to intercept section such as the following and to run it.
<script type="text/python"> from pandas import DataFrame from pyquickhelper.pandashelper.tblformat import df2html pars = [ { "key":k, "value":v } for k,v in params ] tbl = DataFrame (pars) print ( df2html(tbl,class_table="myclasstable") ) </script>
- Parameters:
outStream – instance of a class which should have a method
write
context – context for the script execution (dictionary with local variables)
catch_exception – if True, the parser prints out the exception instead of raising when it happens.
The context is not modified unless it contains container. In that case, it could be.
- __init__(outStream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, context=None, catch_exception=False)¶
- Parameters:
outStream – instance of a class which should have a method
write
context – context for the script execution (dictionary with local variables)
catch_exception – if True, the parser prints out the exception instead of raising when it happens.
The context is not modified unless it contains container. In that case, it could be.
- handle_data(data)¶
Intercepts the data between two tags.
- Parameters:
data – data
- handle_endtag(tag)¶
Intercepts the end of a tag.
- Parameters:
tag – tag
- handle_starttag(tag, attrs)¶
Intercepts the beginning of a tag.
- Parameters:
tag – tag
attrs – attributes
- str_attr(attrs)¶
Returns a string including the parameters values.
- Parameters:
attr – attributes
- Returns:
string
- class pyrsslocal.simple_server.html_script_parser.HTMLScriptParserRemove(strict=False, outStream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, catch_exception=False)¶
Bases:
HTMLScriptParser
Defines a HTML parser. the purpose is to remove the HTML code and the header
- Parameters:
strict –
HTMLParser
outStream – instance of a class which should have a method
write
catch_exception – if True, the parser prints out the exception instead of raising when it happens.
The context is not modified unless it contains container. In that case, it could be.
- __init__(strict=False, outStream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, catch_exception=False)¶
- Parameters:
strict –
HTMLParser
outStream – instance of a class which should have a method
write
catch_exception – if True, the parser prints out the exception instead of raising when it happens.
The context is not modified unless it contains container. In that case, it could be.
- handle_data(data)¶
Intercepts the data between two tags.
- Parameters:
data – data
- handle_endtag(tag)¶
Intercepts the end of a tag.
- Parameters:
tag – tag
- handle_starttag(tag, attrs)¶
Intercepts the beginning of a tag.
- Parameters:
tag – tag
attrs – attributes
- str_attr(attrs)¶
Returns a string including the parameters values.
- Parameters:
attr – attributes
- Returns:
string