How to calculate nodal stress using Python?

Hi 

I like to get nodal stress using python script. The method I am doing now is to find all the elements (i.e. 8 elements) around one node in 3D, then calculate each elemental integration point stress and take an average. Also I am not sure why I cannot use centroid in python. I can only input integration point for stress. question is which integration point? I feel this approach is not correct. Do I need to use shape function etc? sorry, it has been many years since last time using shape function. Thanks for your help. I appreciate it.