possibility of attribute error in resorce_from_data

It now checks `hasattr` before doing `getattr`
Merge pull request #6 from Aplopio/attribute_error

possibility of attribute error in resorce_from_data