linwoodc3 / gdeltPyR

Python based framework to retreive Global Database of Events, Language, and Tone (GDELT) version 1.0 and version 2.0 data.
https://linwoodc3.github.io/gdeltPyR/
GNU General Public License v3.0
203 stars 53 forks source link

BUG: Add exception handling for no data returned #37

Closed linwoodc3 closed 7 years ago

linwoodc3 commented 7 years ago

gdeltPyR returns a non-intuitive error when no data returns for a single 15 minute data pull. Need to add exception handling to make it clearer to the user that no data returned; right now it looks like gdeltPyR is broken.

Example to recreate

import gdelt
gd = gdelt.gdelt()
a=gd.Search('2017 July 27')

[Out]:
...
  File "/Users/linwood/projects/gdeltPyR/gdelt/base.py", line 597, in Search
    if len(results.columns) == 57:
AttributeError: 'NoneType' object has no attribute 'columns'