coxmediagroup/pybrightcove — pull request #10 by calebsmith (2013-09-05 20:20:06+00:00)
Title: Fixed the new retry connection code and connection error handling

The following error was appearing in the logs whenever a connection error occurred:

[2013-09-05 15:38:23,551: ERROR/PoolWorker-1] UBV: Failed to process 10012 www.fe19.wzzk.com: 'str' object has no attribute 'get'
Traceback (most recent call last):
File "/services/django/fe19/storyville/2013-09-04-15-14-44/src/storyville/medley/videos/tasks/brightcove.py", line 508, in process_site
self.process_video_api(site)
File "/services/django/fe19/storyville/2013-09-04-15-14-44/src/storyville/medley/videos/tasks/brightcove.py", line 444, in process_video_api
"playsTotal", "playsTrailingWeek", "referenceId", "renditions"]):
File "/services/django/fe19/storyville/2013-09-04-15-14-44/lib/python2.6/site-packages/pybrightcove/connection.py", line 304, in item_lister
**kwargs)
File "/services/django/fe19/storyville/2013-09-04-15-14-44/lib/python2.6/site-packages/pybrightcove/connection.py", line 279, in get_list
**kwargs)
File "/services/django/fe19/storyville/2013-09-04-15-14-44/lib/python2.6/site-packages/pybrightcove/connection.py", line 234, in _get_response
error_code = data.get('error', {}).get('code', -1)
AttributeError: 'str' object has no attribute 'get'

The code was expecting nested dictionaries in the returned error data, rather than the format: {'error': 'meesage': 'code' #} as documented here: http://support.brightcove.com/en/video-cloud/docs/getting-started-media-api#errorHandling