Skip to content

Commit

Permalink
#83 HTML rendering and key --html were implemented for reports crea…
Browse files Browse the repository at this point in the history
…ted by `--user-info` key
  • Loading branch information
Tim55667757 committed Nov 21, 2022
1 parent 5b9485a commit 29d3865
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion tksbrokerapi/TKSBrokerAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -4636,7 +4636,7 @@ def OverviewUserInfo(self, show: bool = False) -> dict:

info.extend([
"\n## Current user tariff limits\n",
"\nSee also:\n",
"\n### See also\n",
"* Tinkoff limit policy: https://tinkoff.github.io/investAPI/limits/\n",
"* Tinkoff Invest API: https://tinkoff.github.io/investAPI/\n",
" - More about REST API requests: https://tinkoff.github.io/investAPI/swagger-ui/\n",
Expand Down Expand Up @@ -4676,6 +4676,13 @@ def OverviewUserInfo(self, show: bool = False) -> dict:

uLogger.info("User data was saved to file: [{}]".format(os.path.abspath(self.userInfoFile)))

if self.useHTMLReports:
htmlFilePath = self.userInfoFile.replace(".md", ".html") if self.userInfoFile.endswith(".md") else self.userInfoFile + ".html"
with open(htmlFilePath, "w", encoding="UTF-8") as fH:
fH.write(Template(text=MAIN_INFO_TEMPLATE).render(mainTitle="User info", commonCSS=COMMON_CSS, markdown=infoText))

uLogger.info("The report has also been converted to an HTML file: [{}]".format(os.path.abspath(htmlFilePath)))

return view


Expand Down
2 changes: 1 addition & 1 deletion tksbrokerapi/Templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;
font-size: 18px;
color: #333333;
margin: 16px 0 8px 44px;
margin: 16px 0 8px 52px;
}
details {
Expand Down

0 comments on commit 29d3865

Please sign in to comment.