poe-api
poe-api copied to clipboard
0.4.13 seems to break Python 3.11 compatibility
note that quickjs package is not compatible with Python 3.11, so you may face an issue while trying to upgrade poe-api 0.4.13 :D
Originally posted by @asce0 in https://github.com/ading2210/poe-api/issues/184#issuecomment-1646871946
See comment above. Creating as separate issue to keep track of the problem.
I put a note in the README about this. You need the python-dev
package installed if you're on Linux.
Hopefully, in the future, Python 3.11 compatibility can be restored, though?
I am on Windows, BTW.
I am on Windows, BTW.
So how did you install quickjs 🤔
I didn't install it, I used an older Python version for now.
Oh, my bad, I thought you did install it 😅
@ading2210 You can use js2py
instead of quickjs
. js2py
works fine for Python 3.11
import js2py
def extract_formkey(self, html):
script_regex = r'<script>(.+?)</script>'
script_text = "window = {};"
script_text += "".join(re.findall(script_regex, html))
function_regex = r'(window\.[a-zA-Z0-9]{17})=function'
function_text = re.search(function_regex, script_text).group(1)
script_text += f"{function_text}();"
formkey = js2py.eval_js(script_text)
return formkey
js2py
is not sandboxed, and it's possible for a script to call Python functions.
I just found that someone has compiled quickjs for python3.11, and it seems worked for windows
https://github.com/PetterS/quickjs/issues/127
I put a note in the README about this. You need the
python-dev
package installed if you're on Linux.
I still can't install quickjs
> apt-get install python3-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-dev is already the newest version (3.11.2-1+b1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
> pip install quickjs
...
ERROR: Could not build wheels for quickjs, which is required to install pyproject.toml-based projects