keijack / python-eureka-client

A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
183 stars 43 forks source link

422 Unprocessable Entity when using do_service_async #79

Closed ahbe closed 6 months ago

ahbe commented 9 months ago

When using do_service_async to communicate a POST call to another service that requires a JSON data I always get a 422 Unpro cessable Entity error

data = {"image":"path_image_str"}

try:
    res = await eureka_client.do_service_async("app_name", "/api_path",method="POST",data=data,headers={"Authorization": 'Bearer ' + token})
except urllib.request.HTTPError as e:
    print(e) 

I've tried using json.dumps but it yield another error : res was used before being assigned

keijack commented 9 months ago

If json.dumps doesn't work, please check your server side logic. And please check whether your server side accept application/json data but not application/x-www-form-urlencoded

keijack commented 6 months ago

Close for long time silence. If you have any problem, please submit a new one.