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

TypeError: list indices must be integers, not str #30

Closed
erdeerdeerde opened this issue Jan 11, 2018 · 3 comments
Closed

TypeError: list indices must be integers, not str #30

erdeerdeerde opened this issue Jan 11, 2018 · 3 comments

Comments

@erdeerdeerde
Copy link

Hello,

I have a TypeError:

2018-01-11 15:32:19 CET DEBUG: (MainThread) Creating Component Group FOOBAR...
2018-01-11 15:32:19 CET DEBUG: (MainThread) Sending to http://cachet.local/api/v1/components/groups: {
    "collapsed": 2,
    "name": "FOOBAR"
}
2018-01-11 15:32:19 CET INFO: (MainThread) Starting new HTTP connection (1): cachet.local
2018-01-11 15:32:19 CET DEBUG: (MainThread) "POST /api/v1/components/groups HTTP/1.1" 301 185
2018-01-11 15:32:19 CET INFO: (MainThread) Starting new HTTPS connection (1): cachet.local
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
2018-01-11 15:32:19 CET DEBUG: (MainThread) "GET /api/v1/components/groups HTTP/1.1" 200 None
2018-01-11 15:32:19 CET DEBUG: (MainThread) Response Body: {
    "meta": {
        "pagination": {
            "count": 0,
            "links": {
                "next_page": null,
                "previous_page": null
            },
            "current_page": 1,
            "total_pages": 0,
            "per_page": 20,
            "total": 0
        }
    },
    "data": []
}
Traceback (most recent call last):
  File "zabbix-cachet.py", line 701, in <module>
    zbxtr2cachet_new = init_cachet(itservices)
  File "zabbix-cachet.py", line 604, in init_cachet
    group = cachet.new_components_gr(zbx_service['name'])
  File "zabbix-cachet.py", line 389, in new_components_gr
    logging.info('Component Group {} was created ({})'.format(params['name'], data['data']['id']))
TypeError: list indices must be integers, not str

I dont know why data is a list here, i am using the tools from the requierements.txt in the exact versions and Zabbix 3.4.4 as well as cachet: 2.4.0-dev

@qk4l
Copy link
Owner

qk4l commented Jan 11, 2018 via email

@erdeerdeerde
Copy link
Author

I did as you told me and now it returns the following error:


2018-01-11 17:12:38 CET DEBUG: (MainThread) "GET /api/v1/components HTTP/1.1" 200 None
2018-01-11 17:12:38 CET DEBUG: (MainThread) Response Body: {
    "meta": {
        "pagination": {
            "count": 2,
            "links": {
                "next_page": null,
                "previous_page": null
            },
            "current_page": 1,
            "total_pages": 1,
            "per_page": 20,
            "total": 2
        }
    },
    "data": [
        {
            "status": 1,
            "deleted_at": null,
            "description": "foo",
            "status_name": "Funktionsf\u00e4hig",
            "created_at": "2018-01-11 15:52:18",
            "tags": {
                "": ""
            },
            "enabled": true,
            "updated_at": "2018-01-11 15:52:18",
            "id": 5,
            "meta": null,
            "link": "bar",
            "group_id": 2,
            "order": 0,
            "name": "baz"
        },
        {
            "status": 1,
            "deleted_at": null,
            "description": "qux",
            "status_name": "Funktionsf\u00e4hig",
            "created_at": "2018-01-11 16:08:17",
            "tags": {
                "": ""
            },
            "enabled": true,
            "updated_at": "2018-01-11 16:08:17",
            "id": 6,
            "meta": null,
            "link": "",
            "group_id": 2,
            "order": 0,
            "name": "quo"
        }
    ]
}
2018-01-11 17:12:38 CET DEBUG: (MainThread) Creating Cachet component Customer Impact...
2018-01-11 17:12:38 CET DEBUG: (MainThread) Sending to https://cachet.local/api/v1/components: {
    "status": "1",
    "link": "",
    "name": "Customer Impact",
    "group_id": 3,
    "description": ""
}
2018-01-11 17:12:38 CET INFO: (MainThread) Starting new HTTPS connection (1): cachet.local
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
2018-01-11 17:12:38 CET DEBUG: (MainThread) "POST /api/v1/components HTTP/1.1" 400 None
2018-01-11 17:12:38 CET ERROR: (MainThread) ClientHttpError[https://cachet.local/api/v1/components, 400: {"errors":[{"id":"ec9b6e6c-b328-43fa-8585-c785150bf001","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["Das Format von description ist ung\u00fcltig."]}}]}]
2018-01-11 17:12:38 CET ERROR: (MainThread) 'NoneType' object has no attribute '__getitem__'

Best Regards,

Martin

@qk4l
Copy link
Owner

qk4l commented Jan 11, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants