Skip to content

Commit 9a8e1b8

Browse files
author
Roberto De Ioris
authored
Update Http_API.md
1 parent f8a7b32 commit 9a8e1b8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/Http_API.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,24 @@ if request.get_status() >= 2:
5757
ue.log(data['user-agent'])
5858
```
5959

60+
If you want to call request.get_status() in a loop ensure to 'tick' it (otherwise you will block forever as python will never give back control to unreal):
61+
62+
```python
63+
from unreal_engine import IHttpRequest
64+
import json
65+
66+
request = IHttpRequest('GET', 'http://httpbin.org/user-agent')
67+
68+
# run the request
69+
request.process_request()
70+
71+
# check its status
72+
# tick it at each iteration to avoid blocking ue forever !
73+
# the argument of tick is the DeltaSeconds added to the value returned by get_elapsed_time()
74+
while request.get_status() < 2:
75+
request.tick(0.01)
76+
77+
response = request.get_response()
78+
data = json.loads(response.get_content_as_string())
79+
ue.log(data['user-agent'])
80+
```

0 commit comments

Comments
 (0)