ctfy.sdk.admin_resources.ip_location

client.admin.ip_location — which IP location data the platform serves.

 1"""``client.admin.ip_location`` — which IP location data the platform serves."""
 2
 3from __future__ import annotations
 4
 5from ctfy.sdk._helpers import _raise_for_status
 6from ctfy.sdk.base import BaseHttpClient
 7from ctfy.server.models import IpLocationStatus
 8
 9
10class AdminIpLocationResource:
11    def __init__(self, http: BaseHttpClient) -> None:
12        self._http = http
13
14    def status(self) -> IpLocationStatus:
15        """The offline ip2region files in use and the date their data was built.
16
17        An empty ``databases`` means none was found: every address then
18        reads 「未知」. Updating is ``ctfy-admin ip2region update`` on the
19        server's host, not an API call — the files live on its volume.
20        """
21        resp = self._http.request("GET", "/admin/ip-location")
22        _raise_for_status(resp)
23        return IpLocationStatus.model_validate(resp.json())
class AdminIpLocationResource:
11class AdminIpLocationResource:
12    def __init__(self, http: BaseHttpClient) -> None:
13        self._http = http
14
15    def status(self) -> IpLocationStatus:
16        """The offline ip2region files in use and the date their data was built.
17
18        An empty ``databases`` means none was found: every address then
19        reads 「未知」. Updating is ``ctfy-admin ip2region update`` on the
20        server's host, not an API call — the files live on its volume.
21        """
22        resp = self._http.request("GET", "/admin/ip-location")
23        _raise_for_status(resp)
24        return IpLocationStatus.model_validate(resp.json())
AdminIpLocationResource(http: ctfy.sdk.base.BaseHttpClient)
12    def __init__(self, http: BaseHttpClient) -> None:
13        self._http = http
def status(self) -> ctfy.server.models.IpLocationStatus:
15    def status(self) -> IpLocationStatus:
16        """The offline ip2region files in use and the date their data was built.
17
18        An empty ``databases`` means none was found: every address then
19        reads 「未知」. Updating is ``ctfy-admin ip2region update`` on the
20        server's host, not an API call — the files live on its volume.
21        """
22        resp = self._http.request("GET", "/admin/ip-location")
23        _raise_for_status(resp)
24        return IpLocationStatus.model_validate(resp.json())

The offline ip2region files in use and the date their data was built.

An empty databases means none was found: every address then reads 「未知」. Updating is ctfy-admin ip2region update on the server's host, not an API call — the files live on its volume.