Skip to content

Commit afb7737

Browse files
committed
Documentation improvements
1 parent 1e2b5de commit afb7737

File tree

4 files changed

+45
-47
lines changed

4 files changed

+45
-47
lines changed

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
# built documents.
5151
#
5252
# The short X.Y version.
53-
version = '.01'
53+
version = geoip2.__version__
5454
# The full version, including alpha/beta/rc tags.
55-
release = '.01'
55+
release = geoip2.__version__
5656

5757
# The language for content autogenerated by Sphinx. Refer to documentation
5858
# for a list of supported languages.

geoip2/errors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class GeoIP2Error(RuntimeError):
99
"""There was a generic error in GeoIP2.
1010
11-
This class represents a generic error. It extends ``RuntimeError``
11+
This class represents a generic error. It extends :py:exc:`RuntimeError`
1212
and does not add any additional attributes.
1313
1414
"""
@@ -18,7 +18,7 @@ class GeoIP2HTTPError(GeoIP2Error):
1818
"""There was an error when making your HTTP request.
1919
2020
This class represents an HTTP transport error. It extends
21-
``GeoIP2Error`` and adds attributes of its own.
21+
:py:exc:`GeoIP2Error` and adds attributes of its own.
2222
2323
:ivar http_status: The HTTP status code returned
2424
:ivar uri: The URI queried
@@ -33,7 +33,7 @@ class GeoIP2WebServiceError(GeoIP2HTTPError):
3333
"""The GeoIP2 web service returned an error.
3434
3535
This class represents an error returned by MaxMind's GeoIP2 Precision
36-
web service. It extends ``GeoIP2HTTPError``.
36+
web service. It extends :py:exc:`GeoIP2HTTPError`.
3737
3838
:ivar http_status: The HTTP status code returned
3939
:ivar uri: The URI queried

geoip2/models.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ class Country(object):
1919
This class provides the following methods, each of which returns a record
2020
object.
2121
22-
:ivar continent: Returns a ``geoip2.records.Continent`` object
22+
:ivar continent: :py:class:`geoip2.records.Continent` object
2323
representing continent data for the requested IP address.
24-
:ivar country: Returns a ``geoip2.recordsCountry`` object representing
24+
:ivar country: :py:class:`geoip2.recordsCountry` object representing
2525
country data for the requested IP address. This record represents the
2626
country where MaxMind believes the IP is located in.
27-
:ivar registered_country: Returns a ``geoip2.recordsCountry`` object
27+
:ivar registered_country: :py:class:`geoip2.recordsCountry` object
2828
representing the registered country data for the requested IP address.
2929
This record represents the country where the ISP has registered a given
3030
IP block in and may differ from the user's country.
31-
:ivar traits: Returns ``a geoip2.records.Traits`` object representing
31+
:ivar traits: :py:class:`geoip2.records.Traits` object representing
3232
the traits for the request IP address.
3333
3434
"""
@@ -52,22 +52,22 @@ def __init__(self, raw_response, languages=None):
5252
class City(Country):
5353
"""Model class for the GeoIP2 Precision City end point
5454
55-
:ivar city: Returns a ``geoip2.records.City`` object representing
55+
:ivar city: :py:class:`geoip2.records.City` object representing
5656
country data for the requested IP address.
57-
:ivar continent: Returns a ``geoip2.records.Continent`` object
57+
:ivar continent: :py:class:`geoip2.records.Continent` object
5858
representing continent data for the requested IP address.
59-
:ivar country: Returns a ``geoip2.recordsCountry`` object representing
59+
:ivar country: :py:class:`geoip2.recordsCountry` object representing
6060
country data for the requested IP address. This record represents the
6161
country where MaxMind believes the IP is located in.
62-
:ivar location: Returns a ``geoip2.records.Location`` object
62+
:ivar location: :py:class:`geoip2.records.Location` object
6363
representing country data for the requested IP address.
64-
:ivar region: Returns a ``geoip2.records.Region`` object representing
64+
:ivar region: :py:class:`geoip2.records.Region` object representing
6565
country data for the requested IP address.
66-
:ivar registered_country: Returns a ``geoip2.recordsCountry`` object
66+
:ivar registered_country: :py:class:`geoip2.recordsCountry` object
6767
representing the registered country data for the requested IP address.
6868
This record represents the country where the ISP has registered a given
6969
IP block in and may differ from the user's country.
70-
:ivar traits: Returns ``a geoip2.records.Traits`` object representing
70+
:ivar traits: :py:class:`geoip2.records.Traits` object representing
7171
the traits for the request IP address.
7272
7373
"""
@@ -85,22 +85,22 @@ def __init__(self, raw_response, languages=None):
8585
class CityISPOrg(City):
8686
"""Model class for the GeoIP2 Precision City/ISP/Org end point
8787
88-
:ivar city: Returns a ``geoip2.records.City`` object representing
88+
:ivar city: :py:class:`geoip2.records.City` object representing
8989
country data for the requested IP address.
90-
:ivar continent: Returns a ``geoip2.records.Continent`` object
90+
:ivar continent: :py:class:`geoip2.records.Continent` object
9191
representing continent data for the requested IP address.
92-
:ivar country: Returns a ``geoip2.recordsCountry`` object representing
92+
:ivar country: :py:class:`geoip2.recordsCountry` object representing
9393
country data for the requested IP address. This record represents the
9494
country where MaxMind believes the IP is located in.
95-
:ivar location: Returns a ``geoip2.records.Location`` object
95+
:ivar location: :py:class:`geoip2.records.Location` object
9696
representing country data for the requested IP address.
97-
:ivar region: Returns a ``geoip2.records.Region`` object representing
97+
:ivar region: :py:class:`geoip2.records.Region` object representing
9898
country data for the requested IP address.
99-
:ivar registered_country: Returns a ``geoip2.recordsCountry`` object
99+
:ivar registered_country: :py:class`geoip2.recordsCountry` object
100100
representing the registered country data for the requested IP address.
101101
This record represents the country where the ISP has registered a given
102102
IP block in and may differ from the user's country.
103-
:ivar traits: Returns ``a geoip2.records.Traits`` object representing
103+
:ivar traits: :py:class:`geoip2.records.Traits` object representing
104104
the traits for the request IP address.
105105
106106
"""
@@ -109,22 +109,22 @@ class CityISPOrg(City):
109109
class Omni(CityISPOrg):
110110
"""Model class for the GeoIP2 Precision Omni end point
111111
112-
:ivar city: Returns a ``geoip2.records.City`` object representing
112+
:ivar city: :py:class:`geoip2.records.City` object representing
113113
country data for the requested IP address.
114-
:ivar continent: Returns a ``geoip2.records.Continent`` object
114+
:ivar continent: :py:class:`geoip2.records.Continent` object
115115
representing continent data for the requested IP address.
116-
:ivar country: Returns a ``geoip2.recordsCountry`` object representing
116+
:ivar country: :py:class:`geoip2.recordsCountry` object representing
117117
country data for the requested IP address. This record represents the
118118
country where MaxMind believes the IP is located in.
119-
:ivar location: Returns a ``geoip2.records.Location`` object
119+
:ivar location: :py:class:`geoip2.records.Location` object
120120
representing country data for the requested IP address.
121-
:ivar region: Returns a ``geoip2.records.Region`` object representing
121+
:ivar region: :py:class:`geoip2.records.Region` object representing
122122
country data for the requested IP address.
123-
:ivar registered_country: Returns a ``geoip2.recordsCountry`` object
123+
:ivar registered_country: :py:class:`geoip2.recordsCountry` object
124124
representing the registered country data for the requested IP address.
125125
This record represents the country where the ISP has registered a given
126126
IP block in and may differ from the user's country.
127-
:ivar traits: Returns ``a geoip2.records.Traits`` object representing
127+
:ivar traits: :py:class:`geoip2.records.Traits` object representing
128128
the traits for the request IP address.
129129
130130
"""

geoip2/webservices.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,27 +118,25 @@ class Client(object):
118118
passed onto record classes to use when their name properties are
119119
called. The default value is ['en'].
120120
121-
Details on language handling:
121+
The order of the languages is significant. When a record class has
122+
multiple names (country, city, etc.), its name property will return
123+
the name in the first language that has one.
122124
123-
The order of the languages is significant. When a record class has
124-
multiple names (country, city, etc.), its name property will return
125-
the name in the first language that has one.
125+
Note that the only language which is always present in the GeoIP2
126+
Precision data in "en". If you do not include this language, the
127+
name property may end up returning None even when the record hass
128+
an English name.
126129
127-
Note that the only language which is always present in the GeoIP2
128-
Precision data in "en". If you do not include this language, the
129-
name property may end up returning None even when the record hass
130-
an English name.
130+
Currently, the valid list of language codes is:
131131
132-
Currently, the valid list of language codes is:
132+
* en -- English names may still include accented characters if that is
133+
the accepted spelling in English. In other words, English does not
134+
mean ASCII.
135+
* ja -- Japanese
136+
* ru -- Russian
137+
* zh-CN -- Simplified Chinese.
133138
134-
* en -- English names may still include accented characters if that is
135-
the accepted spelling in English. In other words, English does not
136-
mean ASCII.
137-
* ja -- Japanese
138-
* ru -- Russian
139-
* zh-CN -- Simplified Chinese.
140-
141-
Passing any other language code will result in an error.
139+
Passing any other language code will result in an error.
142140
143141
"""
144142

0 commit comments

Comments
 (0)