I am using python requests library to get the data from adzuna api .
if i try
r = requests.get("http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=appID\
&app_key=appKEY&results_per_page=50&\
what=entry%20level&content-type=application/json")
print r.text
it is fetching me data But if i wrap this inside a fuction
def getData ():
r = requests.get("http://api.adzuna.com/v1/api/jobs/gb/search/1?app_id=appID\
&app_key=appKey&results_per_page=50&\
what=entry%20level&content-type=application/json")
print r.text
getData()
it is giving me following exception
{"display":"Authorisation failed","__CLASS__":"Adzuna::API::Response::Exception","doc":"http://api.adzuna.com/v1/doc","exception":"AUTH_FAIL"}
what is the wrong with this function ?