[spyne] python exec function doesn't work in module spyne

Burak Arslan burak.arslan at arskom.com.tr
Thu Aug 2 09:14:50 UTC 2018


hello,


On 02/08/18 11:33, hou zhehao wrote:
> I trigger the function *execcodes *by
> *127.0.0.1:22346/Test?execcodes='a=1\nb=2\nprint(a+b)\n'*,  there was
> no error about exec raised, but there was also no print in logging,
> and I can't find a and b in both locals and globals, so i'm confused
> whether my codes executed? if it is executed, where can I find the
> variables?

without looking at the spyne code, this request is invalid.

try:

    curl
    "127.0.0.1:22346/Test?execcodes=a%3D1%0Ab%3D2%0Aprint%28a%2Bb%29%0A"

in python world, what you need to do is called "url encoding".

the requests library takes care of it for you automatically. Otherwise
the python stdlib also contains functions that takes care of urlencoding.

here's the python snippet that I used to generate the above request:

    import requests
    requests.get("http://127.0.0.1:22346",
    dict(execcodes='a=1\nb=2\nprint(a+b)\n'))


I hope this helps,
Burak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.spyne.io/archives/people/attachments/20180802/a016c4cc/attachment.html>


More information about the people mailing list