...
This commit is contained in:
parent
d16160323c
commit
1e22d28754
34 changed files with 708 additions and 1822 deletions
18
MyObsidianVault/Godot/HTTP Requests/2024-12-22.md
Normal file
18
MyObsidianVault/Godot/HTTP Requests/2024-12-22.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
```python
|
||||
extends Control
|
||||
|
||||
@onready var http_request: HTTPRequest = $btn_login/HTTPRequest
|
||||
@onready var te_result: TextEdit = $te_result
|
||||
|
||||
var url = "https://meowfacts.herokuapp.com/"
|
||||
|
||||
func _on_btn_login_button_up() -> void:
|
||||
var headers = ["Content-Type: application/json"]
|
||||
http_request.request(url, headers, HTTPClient.Method.METHOD_GET)
|
||||
|
||||
func _on_http_request_request_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
var data = JSON.parse_string(body.get_string_from_utf8())
|
||||
te_result.text = data.data[0]
|
||||
```
|
||||
|
||||
![[Pasted image 20241222121529.png]]
|
||||
File diff suppressed because it is too large
Load diff
BIN
MyObsidianVault/_images/Pasted image 20241222121529.png
Normal file
BIN
MyObsidianVault/_images/Pasted image 20241222121529.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Loading…
Add table
Add a link
Reference in a new issue