(self,cmd,fields)
| 218 | # Create a POST request with url-encoded parameters in the body. |
| 219 | # Parameters are passed as a hash in 'fields'. |
| 220 | def build_post_request(self,cmd,fields): |
| 221 | params = self.urlencode(fields) |
| 222 | headers = f"POST /bot{self.token}/{cmd} HTTP/1.1\r\nHost:api.telegram.org\r\nContent-Type:application/x-www-form-urlencoded\r\nContent-Length:{len(params)}\r\n\r\n" |
| 223 | return headers+params |
| 224 | |
| 225 | # MicroPython JSON library does not handle surrogate UTF-16 pairs |
| 226 | # generated by the Telegram API. We need to do it manually by scanning |
no test coverage detected