Whether request.data exists in latest version?

I am study the old blog The Simplest Way to Serve your NLP Model in Production with Pure Python , and I want to practice the snippets in it. But they can not run, such as sklearn_backend.py I got error :

AttributeError: ‘Request’ object has no attribute ‘data’

I don’t know whether the error is caused by the version (my verison is ray, version 1.5.1) ray.serve ? Another, Would you like to tell me what type the “request” is and how to get the methods and properties of the request?

Thank you very much!


Dillon Peng

1 Like

Hi Dillon,

Here’s the relevant migration guide: https://docs.google.com/document/d/1_yyh9Wf5c_A3zHEifezi_36NPfyYgW0Bn0WE1YgNxHs/edit
Note that this guide itself is old, so the examples will not work with 1.5.1, but you can find more examples on the latest docs.

In short, you’ll want to use await request.body(). Here’s the type of the request object: Requests - Starlette

Sorry, the other link may be private, this one should work: Ray Serve Request Migration Guide - Google Docs