module simple_server.html_script_parser

Inheritance diagram of pyrsslocal.simple_server.html_script_parser

Short summary

module pyrsslocal.simple_server.html_script_parser

This modules contains a class which implements a simple server.

source on GitHub

Classes

class

truncated documentation

HTMLScriptParser

Defines a HTML parser. the purpose is to intercept section such as the following and to run it.

HTMLScriptParserRemove

Defines a HTML parser. the purpose is to remove the HTML code and the header

Methods

method

truncated documentation

__init__

__init__

handle_data

Intercepts the data between two tags.

handle_data

Intercepts the data between two tags.

handle_endtag

Intercepts the end of a tag.

handle_endtag

Intercepts the end of a tag.

handle_starttag

Intercepts the beginning of a tag.

handle_starttag

Intercepts the beginning of a tag.

str_attr

Returns a string including the parameters values.

str_attr

Returns a string including the parameters values.

Documentation

This modules contains a class which implements a simple server.

source on GitHub

class pyrsslocal.simple_server.html_script_parser.HTMLScriptParser(outStream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, context=None, catch_exception=False)[source]

Bases: html.parser.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>

source on GitHub

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.

source on GitHub

__init__(outStream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, context=None, catch_exception=False)[source]
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.

source on GitHub

handle_data(data)[source]

Intercepts the data between two tags.

Parameters

data – data

source on GitHub

handle_endtag(tag)[source]

Intercepts the end of a tag.

Parameters

tag – tag

source on GitHub

handle_starttag(tag, attrs)[source]

Intercepts the beginning of a tag.

Parameters
  • tag – tag

  • attrs – attributes

source on GitHub

str_attr(attrs)[source]

Returns a string including the parameters values.

Parameters

attr – attributes

Returns

string

source on GitHub

class pyrsslocal.simple_server.html_script_parser.HTMLScriptParserRemove(strict=False, outStream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, catch_exception=False)[source]

Bases: pyrsslocal.simple_server.html_script_parser.HTMLScriptParser

Defines a HTML parser. the purpose is to remove the HTML code and the header

source on GitHub

Parameters
  • strictHTMLParser

  • 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.

source on GitHub

__init__(strict=False, outStream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, catch_exception=False)[source]
Parameters
  • strictHTMLParser

  • 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.

source on GitHub

handle_data(data)[source]

Intercepts the data between two tags.

Parameters

data – data

source on GitHub

handle_endtag(tag)[source]

Intercepts the end of a tag.

Parameters

tag – tag

source on GitHub

handle_starttag(tag, attrs)[source]

Intercepts the beginning of a tag.

Parameters
  • tag – tag

  • attrs – attributes

source on GitHub

str_attr(attrs)[source]

Returns a string including the parameters values.

Parameters

attr – attributes

Returns

string

source on GitHub