Title: Printing an update isn't too pretty · Issue #12 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: Printing an update isn't too pretty · Issue #12 · python-telegram-bot/python-telegram-bot
X Title: Printing an update isn't too pretty · Issue #12 · python-telegram-bot/python-telegram-bot
Description: Due to the top-down .to_json() approach, all the double quotes get applied and escaped recursively. Example result of calling str(update), where update is for example bot.getUpdates()[0]. {"message": "{\"from\": \"{\\\"id\\\": 1234567890...
Open Graph Description: Due to the top-down .to_json() approach, all the double quotes get applied and escaped recursively. Example result of calling str(update), where update is for example bot.getUpdates()[0]. {"message...
X Description: Due to the top-down .to_json() approach, all the double quotes get applied and escaped recursively. Example result of calling str(update), where update is for example bot.getUpdates()[0]. {"me...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/12
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Printing an update isn't too pretty","articleBody":"Due to the top-down `.to_json()` approach, all the double quotes get applied and escaped recursively. Example result of calling `str(update)`, where update is for example `bot.getUpdates()[0]`.\n\n``` json\n{\"message\": \"{\\\"from\\\": \\\"{\\\\\\\"id\\\\\\\": 1234567890, \\\\\\\"first_name\\\\\\\": \\\\\\\"Somebody\\\\\\\", \\\\\\\"username\\\\\\\": \\\\\\\"somebody\\\\\\\"}\\\", \\\"chat\\\": \\\"{\\\\\\\"id\\\\\\\": 45858904, \\\\\\\"first_name\\\\\\\": \\\\\\\"Somebody\\\\\\\", \\\\\\\"username\\\\\\\": \\\\\\\"somebody\\\\\\\"}\\\", \\\"message_id\\\": 7, \\\"text\\\": \\\"s\\\", \\\"date\\\": 1437171749}\", \"update_id\": 532670696}\n```\n\nProposed solution: Add `datafy`, `to_data` or `to_dict` method to each data container class that is called top-down instead and define `to_json` as:\n\n``` py\ndef to_json(self):\n return json.dumps(self.to_data())\n```\n\nEdit: I would probably add this method in a new base class named `telegram.DataContainer` and make `to_data` abstract.\n","author":{"url":"https://github.com/FichteFoll","@type":"Person","name":"FichteFoll"},"datePublished":"2015-07-17T22:31:35Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/12"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:746a723a-f9ff-3bde-7b81-47f4e67d5e48 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C07C:FEA71:E49A:119FF:6B0288B5 |
| html-safe-nonce | b8e61565e425372ab45929637f371d9c689804b546a564ffc0d96a7160086f24 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDdDOkZFQTcxOkU0OUE6MTE5RkY6NkIwMjg4QjUiLCJ2aXNpdG9yX2lkIjoiNTk4MzAzMzg0MTkyMzgxOTcwMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0955f59ce3bfd5df64dee3cc29ad6d27cee5ef403335f30c42c0ec9a200d6c8f |
| hovercard-subject-tag | issue:95757536 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-telegram-bot/python-telegram-bot/12/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dcf0bbd36a826bb8a413f82d7a1d41b0b1dd2138af884a806b0b089a68af967d/python-telegram-bot/python-telegram-bot/issues/12 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dcf0bbd36a826bb8a413f82d7a1d41b0b1dd2138af884a806b0b089a68af967d/python-telegram-bot/python-telegram-bot/issues/12 |
| og:image:alt | Due to the top-down .to_json() approach, all the double quotes get applied and escaped recursively. Example result of calling str(update), where update is for example bot.getUpdates()[0]. {"message... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | FichteFoll |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-telegram-bot/python-telegram-bot git https://github.com/python-telegram-bot/python-telegram-bot.git |
| octolytics-dimension-user_id | 16178365 |
| octolytics-dimension-user_login | python-telegram-bot |
| octolytics-dimension-repository_id | 38696925 |
| octolytics-dimension-repository_nwo | python-telegram-bot/python-telegram-bot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38696925 |
| octolytics-dimension-repository_network_root_nwo | python-telegram-bot/python-telegram-bot |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width