keiffster / program-y

Python 3.x based AIML 2.0 Chatbot interpreter, framework, related programs and knowledge files
https://keiffster.github.io/program-y/
Other
348 stars 138 forks source link

Incompatibility between Program-Y and Sanic #242

Closed gianfrasoft closed 4 years ago

gianfrasoft commented 4 years ago

We installed the latest version of both Program-Y and Sanic (pip install).

The two software are no more compatible. For example:

in the source file "src/programy/clients/restful/sanic/client.py" the signature:

def create_response(self, response, status_code, version=1.0)

it calls:

    @APP.route('/api/rest/v1.0/ask', methods=['GET', 'POST'])
    async def ask(request):
        response, status = REST_CLIENT.process_request(request, version=1.0)
        return REST_CLIENT.create_response(response, status=status, version=1.0)

    @APP.route('/api/rest/v2.0/ask', methods=['GET', 'POST'])
    async def ask(request):
        response, status = REST_CLIENT.process_request(request, version=2.0)
        return REST_CLIENT.create_response(response, status=status, version=2.0)

using "status" parameter name instead of "status_code" parameter name.

But there could be other incompatibilities.

Have you plans for supporting the Sanic client for Program-Y in the future?

Thank you!

keiffster commented 4 years ago

Let me take a look at see what I did

I’ll get a fix onto master in the next 24 hours or so

On 27 Nov 2019, at 11:28, Gianfranco notifications@github.com wrote:

We installed the latest version of both Program-Y and Sanic (pip install).

The two software are no more compatible. For example:

in the source file "src/programy/clients/restful/sanic/client.py" the signature:

def create_response(self, response, status_code, version=1.0)

it calls:

@APP.route('/api/rest/v1.0/ask', methods=['GET', 'POST'])
async def ask(request):
    response, status = REST_CLIENT.process_request(request, version=1.0)
    return REST_CLIENT.create_response(response, status=status, version=1.0)

@APP.route('/api/rest/v2.0/ask', methods=['GET', 'POST'])
async def ask(request):
    response, status = REST_CLIENT.process_request(request, version=2.0)
    return REST_CLIENT.create_response(response, status=status, version=2.0)

using "status" parameter name instead of "status_code" parameter name.

But there could be other incompatibilities.

Have you plans for supporting the Sanic client for Program-Y in the future?

Thank you!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/keiffster/program-y/issues/242?email_source=notifications&email_token=ABCUFM5XYFAJVR3EJ2QDOIDQVZKXXA5CNFSM4JSFNUCKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H4MJJ5Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCUFM2DLIBKK7WIL23JARDQVZKXXANCNFSM4JSFNUCA.

keiffster commented 4 years ago

Just pushed a fix to master, and tested it working with Sanic

Apologies introduced a typo when refactoring the Flask and Sonic clients

K

On 27 Nov 2019, at 11:28, Gianfranco notifications@github.com wrote:

We installed the latest version of both Program-Y and Sanic (pip install).

The two software are no more compatible. For example:

in the source file "src/programy/clients/restful/sanic/client.py" the signature:

def create_response(self, response, status_code, version=1.0)

it calls:

@APP.route('/api/rest/v1.0/ask', methods=['GET', 'POST'])
async def ask(request):
    response, status = REST_CLIENT.process_request(request, version=1.0)
    return REST_CLIENT.create_response(response, status=status, version=1.0)

@APP.route('/api/rest/v2.0/ask', methods=['GET', 'POST'])
async def ask(request):
    response, status = REST_CLIENT.process_request(request, version=2.0)
    return REST_CLIENT.create_response(response, status=status, version=2.0)

using "status" parameter name instead of "status_code" parameter name.

But there could be other incompatibilities.

Have you plans for supporting the Sanic client for Program-Y in the future?

Thank you!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/keiffster/program-y/issues/242?email_source=notifications&email_token=ABCUFM5XYFAJVR3EJ2QDOIDQVZKXXA5CNFSM4JSFNUCKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H4MJJ5Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCUFM2DLIBKK7WIL23JARDQVZKXXANCNFSM4JSFNUCA.