Skip to content

Key error at urbanairship/common.py L 66 #41

Description

@CatBia

We only accept issues for bug reporting purposes.

All feature requests, implementation concerns or general queries should be sent to our support team.

Before completing the form below, please check the following:

  • You are using the most recent version of the library. --->3.0.1
  • You are using a supported version of Python for that library --->version. 3.6
  • This issue is reproducible.

Expected Behavior

When you upload a file to a Static List, and the csv is delimited with ; string:

import urbanairship as ua
from local_credentials import uas

airshipauth = ua.Airship(**uas)

#creating a Static List:
new_static_list = ua.devices.StaticList(airshipauth, 'new_static_list')
new_static_list.create()
# it returns {'ok':True}
#uploading list
with open('users.csv', 'rb') as _file:
    new_static_list.upload(_file)
# ????

Current Behavior

But, you get KeyError exception for some non-expected exception at core.py:

    new_static_list.upload(_file)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-46-d4f457512c8d> in <module>()
----> 1 result.upload(_file)

~/anaconda3/envs/genericenv/lib/python3.6/site-packages/urbanairship/devices/static_lists.py in upload(self, csv_file)
     48             content_type='text/csv',
     49             version=3,
---> 50             encoding='gzip'
     51         )
     52         return response.json()

~/anaconda3/envs/genericenv/lib/python3.6/site-packages/urbanairship/core.py in _request(self, method, body, url, content_type, version, params, encoding)
     63             raise common.Unauthorized
     64         elif not (200 <= response.status_code < 300):
---> 65             raise common.AirshipFailure.from_response(response)
     66 
     67         return response

~/anaconda3/envs/genericenv/lib/python3.6/site-packages/urbanairship/common.py in from_response(cls, response)
     63             error = payload['error']
     64             error_code = payload['error_code']
---> 65             details = payload['details']
     66         except (ValueError, TypeError):
     67             error = response.reason

KeyError: 'details'

Steps to Reproduce

Detailed Description

in Current Behaviour

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions