lfgBndZddlZddlmZddlmZmZmZmZm Z m Z ddl Z ddl mZGddeZGdd eZGd d eZGd d eZGddeeZGddeZGddeZGddeZGddeZGddeZdS)a& Models ====== These classes provide models for the data returned by the GeoIP2 web service and databases. The only difference between the City and Insights model classes is which fields in each record may be populated. See http://dev.maxmind.com/geoip/geoip2/web-services for more details. N)ABCMeta)AnycastDictListOptionalUnion)SimpleEqualityceZdZUdZejjed<ejjed<ejj ed<ejjed<ejj ed<ejj ed< dd e e efd eee d dfd Zd e fd ZdS)CountryaCModel for the GeoIP2 Precision: Country and the GeoIP2 Country database. This class provides the following attributes: .. attribute:: continent Continent object for the requested IP address. :type: :py:class:`geoip2.records.Continent` .. attribute:: country Country object for the requested IP address. This record represents the country where MaxMind believes the IP is located. :type: :py:class:`geoip2.records.Country` .. attribute:: maxmind Information related to your MaxMind account. :type: :py:class:`geoip2.records.MaxMind` .. attribute:: registered_country The registered country object for the requested IP address. This record represents the country where the ISP has registered a given IP block in and may differ from the user's country. :type: :py:class:`geoip2.records.Country` .. attribute:: represented_country Object for the country represented by the users of the IP address when that country is different than the country in ``country``. For instance, the country represented by an overseas military base. :type: :py:class:`geoip2.records.RepresentedCountry` .. attribute:: traits Object with the traits of the requested IP address. :type: :py:class:`geoip2.records.Traits` continentcountrymaxmindregistered_countryrepresented_countrytraitsN raw_responselocalesreturnch|dg}||_tjj|fi|di|_tjj|fi|di|_tjj|fi|di|_tjj |fi|di|_ tjj di|di|_ tjj di|di|_||_dS) Nenr rrrrr)_localesgeoip2records Continentgetr r rrRepresentedCountryrMaxMindrTraitsrraw)selfrrs m/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/geoip2/models.py__init__zCountry.__init__MsZ ?fG 1   #'' R88  ~-   #'' 266   #)."8 # # #''(#D $ $ #''(=rBB$ $  ~-PP 0@0@B0O0OPP n+MMl.>.>x.L.LMM cP|jd|jjd|jd|jdS)N.(z, )) __module__ __class____name__r!rr"s r#__repr__zCountry.__repr__es6 W W!8 W W48 W Wt} W W W r%N)r,r* __qualname____doc__rrr__annotations__r rrr rstrrrrr$r.rr%r#r r s--^~'''' ^ #### ^ ####....:::: N !!!!LP   cN 5=d3i5H     0 #      r%r ceZdZUdZejjed<ejjed<ejj ed<ejj ed< d de e e fdeee d dffd ZxZS) Citya_Model for the GeoIP2 Precision: City and the GeoIP2 City database. .. attribute:: city City object for the requested IP address. :type: :py:class:`geoip2.records.City` .. attribute:: continent Continent object for the requested IP address. :type: :py:class:`geoip2.records.Continent` .. attribute:: country Country object for the requested IP address. This record represents the country where MaxMind believes the IP is located. :type: :py:class:`geoip2.records.Country` .. attribute:: location Location object for the requested IP address. :type: :py:class:`geoip2.records.Location` .. attribute:: maxmind Information related to your MaxMind account. :type: :py:class:`geoip2.records.MaxMind` .. attribute:: postal Postal object for the requested IP address. :type: :py:class:`geoip2.records.Postal` .. attribute:: registered_country The registered country object for the requested IP address. This record represents the country where the ISP has registered a given IP block in and may differ from the user's country. :type: :py:class:`geoip2.records.Country` .. attribute:: represented_country Object for the country represented by the users of the IP address when that country is different than the country in ``country``. For instance, the country represented by an overseas military base. :type: :py:class:`geoip2.records.RepresentedCountry` .. attribute:: subdivisions Object (tuple) representing the subdivisions of the country to which the location of the requested IP address belongs. :type: :py:class:`geoip2.records.Subdivisions` .. attribute:: traits Object with the traits of the requested IP address. :type: :py:class:`geoip2.records.Traits` citylocationpostal subdivisionsNrrrct||tjj|fi|di|_tjjdi|di|_tjj di|di|_ tjj |g|dgR|_ dS)Nr6r7r8r9r) superr$rrr5rr6Locationr7Postalr8 Subdivisionsr9)r"rrr+s r#r$z City.__init__s w///N'PP<3C3CFB3O3OPP /SS,2B2B:r2R2RSS n+MMl.>.>x.L.LMM "N7  "&&~r::   r%r/)r,r*r0r1rrr5r2r<r=r>rr3rrrr$ __classcell__r+s@r#r5r5ksDDL . n%%%% N !!!!.----LP    cN  5=d3i5H             r%r5ceZdZdZdS)InsightsaModel for the GeoIP2 Precision: Insights web service endpoint. .. attribute:: city City object for the requested IP address. :type: :py:class:`geoip2.records.City` .. attribute:: continent Continent object for the requested IP address. :type: :py:class:`geoip2.records.Continent` .. attribute:: country Country object for the requested IP address. This record represents the country where MaxMind believes the IP is located. :type: :py:class:`geoip2.records.Country` .. attribute:: location Location object for the requested IP address. .. attribute:: maxmind Information related to your MaxMind account. :type: :py:class:`geoip2.records.MaxMind` .. attribute:: registered_country The registered country object for the requested IP address. This record represents the country where the ISP has registered a given IP block in and may differ from the user's country. :type: :py:class:`geoip2.records.Country` .. attribute:: represented_country Object for the country represented by the users of the IP address when that country is different than the country in ``country``. For instance, the country represented by an overseas military base. :type: :py:class:`geoip2.records.RepresentedCountry` .. attribute:: subdivisions Object (tuple) representing the subdivisions of the country to which the location of the requested IP address belongs. :type: :py:class:`geoip2.records.Subdivisions` .. attribute:: traits Object with the traits of the requested IP address. :type: :py:class:`geoip2.records.Traits` Nr,r*r0r1rr%r#rBrB<<<<r%rBceZdZdZdS) EnterpriseaModel for the GeoIP2 Enterprise database. .. attribute:: city City object for the requested IP address. :type: :py:class:`geoip2.records.City` .. attribute:: continent Continent object for the requested IP address. :type: :py:class:`geoip2.records.Continent` .. attribute:: country Country object for the requested IP address. This record represents the country where MaxMind believes the IP is located. :type: :py:class:`geoip2.records.Country` .. attribute:: location Location object for the requested IP address. .. attribute:: maxmind Information related to your MaxMind account. :type: :py:class:`geoip2.records.MaxMind` .. attribute:: registered_country The registered country object for the requested IP address. This record represents the country where the ISP has registered a given IP block in and may differ from the user's country. :type: :py:class:`geoip2.records.Country` .. attribute:: represented_country Object for the country represented by the users of the IP address when that country is different than the country in ``country``. For instance, the country represented by an overseas military base. :type: :py:class:`geoip2.records.RepresentedCountry` .. attribute:: subdivisions Object (tuple) representing the subdivisions of the country to which the location of the requested IP address belongs. :type: :py:class:`geoip2.records.Subdivisions` .. attribute:: traits Object with the traits of the requested IP address. :type: :py:class:`geoip2.records.Traits` NrCrr%r#rFrFrDr%rFceZdZUdZeeeeeeffe d<ee d<deeeeeeffddfdZ defdZ e de eejejffdZdS) SimpleModelz.Provides basic methods for non-location modelsr! ip_addressrNc||_d|_|d|_t t |d|_dS)N prefix_lenrI)r!_networkr _prefix_lenrr3rI)r"r!s r#r$zSimpleModel.__init__IsE 77<00sCGGL$9$9::r%c@|jd|jjd|jdS)Nr'r(r))r*r+r,r!r-s r#r.zSimpleModel.__repr__Os*/IIDN$;IIdhIIIIr%c|j}t|tjtjfr|S|j}|j}||dStj|d|d}||_|S)zThe network for the recordN/F)rL isinstance ipaddress IPv4Network IPv6NetworkrIrM ip_network)r"networkrIrKs r#rVzSimpleModel.networkRsx - g 5y7LM N N N_ %  !34&*'C'Cz'C'CUKK r%)r,r*r0r1rr3r boolintr2r$r.propertyrrRrSrTrVrr%r#rHrHCs88 c5sC(( ))))OOO;DeD#sN&;!;<;;;;; J#JJJJ% (=y?T(T"UVXr%rH) metaclassczeZdZUdZeed<eed<eed<eed<eed<eed<deeefd d ffd ZxZ S) AnonymousIPaModel class for the GeoIP2 Anonymous IP. This class provides the following attribute: .. attribute:: is_anonymous This is true if the IP address belongs to any sort of anonymous network. :type: bool .. attribute:: is_anonymous_vpn This is true if the IP address is registered to an anonymous VPN provider. If a VPN provider does not register subnets under names associated with them, we will likely only flag their IP ranges using the ``is_hosting_provider`` attribute. :type: bool .. attribute:: is_hosting_provider This is true if the IP address belongs to a hosting or VPN provider (see description of ``is_anonymous_vpn`` attribute). :type: bool .. attribute:: is_public_proxy This is true if the IP address belongs to a public proxy. :type: bool .. attribute:: is_residential_proxy This is true if the IP address is on a suspected anonymizing network and belongs to a residential ISP. :type: bool .. attribute:: is_tor_exit_node This is true if the IP address is a Tor exit node. :type: bool .. attribute:: ip_address The IP address used in the lookup. :type: unicode .. attribute:: network The network associated with the record. In particular, this is the largest network where all of the fields besides ip_address have the same value. :type: ipaddress.IPv4Network or ipaddress.IPv6Network is_anonymousis_anonymous_vpnis_hosting_provideris_public_proxyis_residential_proxyis_tor_exit_noder!rNct||dd|_|dd|_|dd|_|dd|_|dd|_|dd|_dS)Nr]Fr^r_r`rarb) r;r$rr]r^r_r`rarbr"r!r+s r#r$zAnonymousIP.__init__s GGNE:: #(:E B B#&77+@%#H#H "ww'8%@@$'GG,BE$J$J! #(:E B Br%) r,r*r0r1rWr2rr3r$r?r@s@r#r\r\ds<<|CDdOCCCCCCCCCCCr%r\czeZdZUdZeeed<eeed<deee eeffddffd Z xZ S)ASNaModel class for the GeoLite2 ASN. This class provides the following attribute: .. attribute:: autonomous_system_number The autonomous system number associated with the IP address. :type: int .. attribute:: autonomous_system_organization The organization associated with the registered autonomous system number for the IP address. :type: unicode .. attribute:: ip_address The IP address used in the lookup. :type: unicode .. attribute:: network The network associated with the record. In particular, this is the largest network where all of the fields besides ip_address have the same value. :type: ipaddress.IPv4Network or ipaddress.IPv6Network autonomous_system_numberautonomous_system_organizationr!rNc*t|ttt|d|_ttt|d|_dS)Nrgrh) r;r$rrrXrrgr3rhrds r#r$z ASN.__init__ss (, SM377#=>>) ) %/3 SM377#CDD/ / +++r%) r,r*r0r1rrXr2r3rr r$r?r@s@r#rfrfs@'sm+++$,SM111 DeCHo!56 4          r%rfcdeZdZUdZeeed<deeeee ffddffd Z xZ S)ConnectionTypeaModel class for the GeoIP2 Connection-Type. This class provides the following attribute: .. attribute:: connection_type The connection type may take the following values: - Dialup - Cable/DSL - Corporate - Cellular Additional values may be added in the future. :type: unicode .. attribute:: ip_address The IP address used in the lookup. :type: unicode .. attribute:: network The network associated with the record. In particular, this is the largest network where all of the fields besides ip_address have the same value. :type: ipaddress.IPv4Network or ipaddress.IPv6Network connection_typer!rNct|ttt|d|_dS)Nrl)r;r$rrr3rrlrds r#r$zConnectionType.__init__sD #HSM377;L3M3MNNr% r,r*r0r1rr3r2rr rXr$r?r@s@r#rkrks@c]"""ODeCHo!56O4OOOOOOOOOOr%rkcdeZdZUdZeeed<deeeee ffddffd Z xZ S)DomainaModel class for the GeoIP2 Domain. This class provides the following attribute: .. attribute:: domain The domain associated with the IP address. :type: unicode .. attribute:: ip_address The IP address used in the lookup. :type: unicode .. attribute:: network The network associated with the record. In particular, this is the largest network where all of the fields besides ip_address have the same value. :type: ipaddress.IPv4Network or ipaddress.IPv6Network domainr!rNct|ttt|d|_dS)Nrq)r;r$rrr3rrqrds r#r$zDomain.__init__(s@ 8C=#''(*;*;<< r%rnr@s@r#rprp s{4 SM=DeCHo!56=4==========r%rpczeZdZUdZeeed<eeed<deeeee ffddffd Z xZ S)ISPaModel class for the GeoIP2 ISP. This class provides the following attribute: .. attribute:: autonomous_system_number The autonomous system number associated with the IP address. :type: int .. attribute:: autonomous_system_organization The organization associated with the registered autonomous system number for the IP address. :type: unicode .. attribute:: isp The name of the ISP associated with the IP address. :type: unicode .. attribute:: organization The name of the organization associated with the IP address. :type: unicode .. attribute:: ip_address The IP address used in the lookup. :type: unicode .. attribute:: network The network associated with the record. In particular, this is the largest network where all of the fields besides ip_address have the same value. :type: ipaddress.IPv4Network or ipaddress.IPv6Network isp organizationr!rNc*t|ttt|d|_ttt|d|_dS)Nrurv)r;r$rrr3rrurvrds r#r$z ISP.__init__^sb  swwu~~66 #0G0GHHr%rnr@s@r#rtrt-s**X #3-IDeCHo!56I4IIIIIIIIIIr%rt)r1rRabcrtypingrrrrrr geoip2.recordsr geoip2.mixinsr r r5rBrFrHr\rfrkrprtrr%r#r|sm  9999999999999999((((((R R R R R nR R R jU U U U U 7U U U p=====t===@========@.GBMCMCMCMCMC+MCMCMC`, , , , , +, , , ^%O%O%O%O%O[%O%O%OP=====[===D4I4I4I4I4I#4I4I4I4I4Ir%