Title: Improve and extend the _read() method availability for its users and related methods. Part 2: Response format validator by belono · Pull Request #711 · python-escpos/python-escpos · GitHub
Open Graph Title: Improve and extend the _read() method availability for its users and related methods. Part 2: Response format validator by belono · Pull Request #711 · python-escpos/python-escpos
X Title: Improve and extend the _read() method availability for its users and related methods. Part 2: Response format validator by belono · Pull Request #711 · python-escpos/python-escpos
Description: Description This is part 2 of the series to improve and extend the availability of the _read() method. Part 1: #709 Part 2: Add a simple response format validator when querying for status: As stated at the Epson ESC/POS reference guide: Each status consists of 1 byte, and the value is 0xx1xx10b. The real time status can be differentiated by the bits 0, 1, 4, and 7 from other transmission data, except for data in block data (Header – NUL). So a status response consists of a byte which bits 0 and 7 are fixed to 0, and bits 1 and 4 are fixed to 1. The remaining bits contain the response to the query according to the tables given in the aforementioned reference guide. This PR tries to reduce the possibility of false positives when interpreting data from the printer buffer as status responses by checking that the data read is at least in the right response format: Add a simple validator method to validate every status format before return it as a response. Log an error if validation fails. Optionally raise a (new) ValidationError exception if validation fails, or return an empty response (default). Treat an empty response as a negative response for the query_status() users: is_online() and paper_status() methods. Add tests for the status read functions. Part 3: #712 Part 4: #714 Tested with TM-U210 Parallel port printer
Open Graph Description: Description This is part 2 of the series to improve and extend the availability of the _read() method. Part 1: #709 Part 2: Add a simple response format validator when querying for status: As state...
X Description: Description This is part 2 of the series to improve and extend the availability of the _read() method. Part 1: #709 Part 2: Add a simple response format validator when querying for status: As state...
Opengraph URL: https://github.com/python-escpos/python-escpos/pull/711
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:cbbe28ec-811d-b8e9-cc50-d97f44b056cb |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E918:C5A49:6B19BB:911BFD:6A4DD170 |
| html-safe-nonce | ceb7a5c8c246a86c1d7cfa6181c5d92792919318ce6cb39bca8da6e8fca99924 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTE4OkM1QTQ5OjZCMTlCQjo5MTFCRkQ6NkE0REQxNzAiLCJ2aXNpdG9yX2lkIjoiNTQ4MTcwOTgwNTgzMDUyNTI5NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 02a06b721bb97d369e3b83066fa48e96175e6d928a9a536cefe4001722b72f98 |
| hovercard-subject-tag | pull_request:2887585969 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python-escpos/python-escpos/pull/711/files |
| twitter:image | https://avatars.githubusercontent.com/u/12175851?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/12175851?s=400&v=4 |
| og:image:alt | Description This is part 2 of the series to improve and extend the availability of the _read() method. Part 1: #709 Part 2: Add a simple response format validator when querying for status: As state... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python-escpos/python-escpos git https://github.com/python-escpos/python-escpos.git |
| octolytics-dimension-user_id | 16302939 |
| octolytics-dimension-user_login | python-escpos |
| octolytics-dimension-repository_id | 32363483 |
| octolytics-dimension-repository_nwo | python-escpos/python-escpos |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 32363483 |
| octolytics-dimension-repository_network_root_nwo | python-escpos/python-escpos |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width