Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I return str from request? #123

Open
danylott opened this issue Mar 30, 2021 · 2 comments
Open

Can I return str from request? #123

danylott opened this issue Mar 30, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@danylott
Copy link
Contributor

danylott commented Mar 30, 2021

from panini import app as panini_app

app = panini_app.App(
        service_name='your-microservice-name',
        host='127.0.0.1',
        port=4222,
)


@app.timer_task(interval=2)
async def send_request():
    for _ in range(2):
        message = "Str Message"
        response = await app.request(subject='some.subject', message=message, data_type=str)
        print(response)


@app.listen('some.subject', data_type=str)
async def subject_for_requests_listener(msg):
    return msg.data

if __name__ == "__main__":
    app.start()

I'm getting this error: panini.exceptions.DataTypeError: Expected dict but got <class 'str'>

@danylott danylott added the question Further information is requested label Mar 30, 2021
@artas728
Copy link
Collaborator

In this case should expect <class 'str'> in response

@artas728 artas728 added bug Something isn't working and removed question Further information is requested labels Mar 31, 2021
@danylott
Copy link
Contributor Author

danylott commented Apr 6, 2021

Btw, if so - we have also the problem here in examples

@artas728 artas728 self-assigned this Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants