Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flower Http Api get Celery task details

I have a working celery flower project.
Now I want some celery failed task details using flower http api, but my celery is using --basic-auth for authentication and when I make a request at flower http api on http://localhost:5555/api/tasks it timeouts and does not show any results.

I did not understand if this is an auth problem or something else. I look to flower docs but i did not get any idea. Thanks for you time. Below is the code that is not working for me.

import requests

params = (('state', 'FAILURE'),('limit', '5'),)

requests.get('http://localhost:5555/api/tasks', params=params)
like image 560
Manish Yadav Avatar asked Nov 30 '25 11:11

Manish Yadav


1 Answers

Then you should make your request with your credentials:

  1. Import HTTPBasicAuth (since you are using --basic-auth):

    from requests.auth import HTTPBasicAuth
    
  2. Make an authenticated request:

    requests.get(
        'http://localhost:5555/api/tasks', 
        auth=HTTPBasicAuth('your_user', 'your_pass'), 
        params=params
    )
    

Good luck :)

like image 134
John Moutafis Avatar answered Dec 03 '25 01:12

John Moutafis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!