By: Abhinay B. user 19 Nov 2018 at 11:09 p.m. CST

1 Response
Abhinay B. gravatar
I am unable to execute a simple Get method using HttpService. Here is the code snippet from [allowed_countries.py](https://github.com/GluuFederation/oxAuth/blob/master/Server/integrations/allowed_countries/allowed_countries.py): ``` from org.xdi.oxauth.service.net import HttpService httpService = CdiUtil.bean(HttpService) http_client = httpService.getHttpsClient() http_client_params = http_client.getParams() http_client_params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 15 * 1000) geolocation_service_url = "http://ip-api.com/json/%s?fields=520191" % remote_ip geolocation_service_headers = { "Accept" : "application/json" } try: http_service_response = httpService.executeGet(http_client, geolocation_service_url, geolocation_service_headers) http_response = http_service_response.getHttpResponse() except: print "Super-Gluu. Determine remote location. Exception: ", sys.exc_info()[1] return None ``` Error obtained: 'NoneType' object has no attribute 'getHttpResponse' Looks like the httpService.executeGet method returned a NoneType. To check the validity of the geolocation_service_url, I pasted the same URL in my browser and successfully obtained the necessary information. Could you help me?

By Aliaksandr Samuseu staff 20 Nov 2018 at 8:06 a.m. CST

Aliaksandr Samuseu gravatar
Hi, Abhinay. We can't afford offering support for complex tasks like custom script development within scope of Community Support. Please spend some time researching source code and existing custom scripts to learn how to use this class/method properly. If you'll happen to find out it's a bug which prevents its usage, let us know and we'll do our best to fix it and share a solution with you. >To check the validity of the geolocation_service_url, I pasted the same URL in my browser and successfully obtained the necessary information. To test whether this url is accessible from custom script you must try to fetch it **from within Gluu Server's container**, not from a browser running on some other machine. Try to retrieve it with `wget` or `curl` from there, it may be simple name resolution issue.