Manish Yadav Manish Yadav - 2 years ago 177
Python Question

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)

Answer Source

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 :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download