Demo entry 6734479

werty

   

Submitted by wertyui on Apr 20, 2018 at 16:57
Language: Python 3. Code size: 641 Bytes.

func _request(uri, method, body={}, headers=header_def):
	err = http.request(method, uri, headers, http.query_string_from_dict(body))
	assert(err == OK)

	while http.get_status() == HTTPClient.STATUS_REQUESTING:

		http.poll()
		print("Requesting..")
		OS.delay_msec(500)

	if (http.get_status() == HTTPClient.STATUS_BODY or http.get_status() == HTTPClient.STATUS_CONNECTED): # Make sure request finished well.
		if http.has_response():
			emit_signal("request_completed", _get_result(), http.get_response_headers_as_dictionary(), http.get_response_code(), http.get_status())
		else:
			print("No Response From Request")
	pass

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).