MCPcopy Create free account
hub / github.com/antirez/freakwan / build_post_request

Method build_post_request

telegram.py:220–223  ·  view source on GitHub ↗
(self,cmd,fields)

Source from the content-addressed store, hash-verified

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

Callers 1

send_api_requestsMethod · 0.95

Calls 1

urlencodeMethod · 0.95

Tested by

no test coverage detected