Web Requests and Android
Posted: Sun Jun 24, 2018 2:57 pm
Hi folks,
I'm after a little advice on web requests with Android. I am using the modified version of the python requests module for Ren'Py (https://github.com/renpytom/renpy-requests) to download some personalisation data and send to server for processing with a simple REST API. Later in the game, I will use it to publish data.
All is working well in Windows, but when I build the game for Android, it throws a runtime error, below
Has anyone had any success with Android and Requests?
The other question I have in this area is that I want to use the renpy.invoke_thread for the web interactions so it doesn't block the main thread. But what is the best approach for allowing renpy to pass data between the main and daemon thread?
I'm after a little advice on web requests with Android. I am using the modified version of the python requests module for Ren'Py (https://github.com/renpytom/renpy-requests) to download some personalisation data and send to server for processing with a simple REST API. Later in the game, I will use it to publish data.
All is working well in Windows, but when I build the game for Android, it throws a runtime error, below
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "renpy/common/000statements.rpy", line 414, in execute_pause
File "renpy/common/00action_other.rpy", line 517, in __call__
File "game/script.rpy", line 47, in webRequest
ImportError: cannot import name HTTPConnectionPool
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "script.rpyc", line 102, in script
File "/data/user/0/com.egr.lost/files/renpy/ast.py", line 1828, in execute
self.call("execute")
File "/data/user/0/com.egr.lost/files/renpy/ast.py", line 1816, in call
return renpy.statements.call(method, parsed, *args, **kwargs)
File "/data/user/0/com.egr.lost/files/renpy/statements.py", line 177, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 414, in execute_pause
File "/data/user/0/com.egr.lost/files/renpy/exports.py", line 1452, in with_statement
return renpy.game.interface.do_with(trans, paired, clear=clear)
File "/data/user/0/com.egr.lost/files/renpy/display/core.py", line 2207, in do_with
clear=clear)
File "/data/user/0/com.egr.lost/files/renpy/display/core.py", line 2649, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "/data/user/0/com.egr.lost/files/renpy/display/core.py", line 3451, in interact_core
rv = root_widget.event(ev, x, y, 0)
File "/data/user/0/com.egr.lost/files/renpy/display/layout.py", line 992, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/data/user/0/com.egr.lost/files/renpy/display/transition.py", line 45, in event
return self.new_widget.event(ev, x, y, st) # E1101
File "/data/user/0/com.egr.lost/files/renpy/display/layout.py", line 992, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/data/user/0/com.egr.lost/files/renpy/display/layout.py", line 992, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/data/user/0/com.egr.lost/files/renpy/display/screen.py", line 697, in event
rv = self.child.event(ev, x, y, st)
File "/data/user/0/com.egr.lost/files/renpy/display/layout.py", line 992, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/data/user/0/com.egr.lost/files/renpy/display/behavior.py", line 1993, in event
return run(self.function, *self.args, **self.kwargs)
File "/data/user/0/com.egr.lost/files/renpy/display/behavior.py", line 315, in run
return action(*args, **kwargs)
File "renpy/common/00action_other.rpy", line 517, in __call__
File "game/script.rpy", line 47, in webRequest
File "/data/user/0/com.egr.lost/files/renpy/loader.py", line 723, in load_module
exec code in mod.__dict__
File "requests/__init__.py", line 65, in <module>
File "/data/user/0/com.egr.lost/files/renpy/loader.py", line 723, in load_module
exec code in mod.__dict__
File "requests/api.py", line 13, in <module>
File "/data/user/0/com.egr.lost/files/renpy/loader.py", line 723, in load_module
exec code in mod.__dict__
File "requests/sessions.py", line 26, in <module>
File "/data/user/0/com.egr.lost/files/renpy/loader.py", line 723, in load_module
exec code in mod.__dict__
File "requests/adapters.py", line 15, in <module>
File "/data/user/0/com.egr.lost/files/renpy/loader.py", line 723, in load_module
exec code in mod.__dict__
File "requests/packages/urllib3/poolmanager.py", line 12, in <module>
ImportError: cannot import name HTTPConnectionPool
Has anyone had any success with Android and Requests?
The other question I have in this area is that I want to use the renpy.invoke_thread for the web interactions so it doesn't block the main thread. But what is the best approach for allowing renpy to pass data between the main and daemon thread?