def retrieve(self, request, pk=None): # result = (self.xform(m) for m in all_markets()) # def get(self, request, *args, **kwargs): # Process any get params that you may need # If you don't need to process get params, # you can skip this part get_arg1 = request.GET.get('arg1', None) get_arg2 = request.GET.get('arg2', None) ip_addr = pk if ip_addr == '': ip_addr = request.META.get('HTTP_X_FORWARDED_FOR', request.META.get('REMOTE_ADDR')) result = get_geo(ip_addr) result = result.__dict__ response = Response(result, status=status.HTTP_200_OK) return response
def ip_basic(request, s): ip_addr = s if ip_addr == '': ip_addr = request.META.get('HTTP_X_FORWARDED_FOR', request.META.get('REMOTE_ADDR')) return get_geo(ip_addr).__dict__