[Python-modules-commits] [python-geoip2] 01/05: import python-geoip2_2.4.0.orig.tar.gz
Martin Kratochvíl
krata-guest at moszumanska.debian.org
Mon Nov 21 11:12:39 UTC 2016
This is an automated email from the git hooks/post-receive script.
krata-guest pushed a commit to branch master
in repository python-geoip2.
commit 1423f32c07f67ae4635e5e7bc2b121f2ff5dfa08
Author: Martin Kratochvíl <martin.kratochvil at firma.seznam.cz>
Date: Tue Nov 15 13:45:36 2016 +0100
import python-geoip2_2.4.0.orig.tar.gz
---
HISTORY.rst | 173 +
LICENSE | 202 +
MANIFEST.in | 2 +
PKG-INFO | 412 +
README.rst | 389 +
docs/html/.buildinfo | 4 +
docs/html/_sources/index.txt | 43 +
docs/html/_static/ajax-loader.gif | Bin 0 -> 673 bytes
docs/html/_static/basic.css | 599 ++
docs/html/_static/comment-bright.png | Bin 0 -> 3500 bytes
docs/html/_static/comment-close.png | Bin 0 -> 3578 bytes
docs/html/_static/comment.png | Bin 0 -> 3445 bytes
docs/html/_static/contents.png | Bin 0 -> 202 bytes
docs/html/_static/doctools.js | 263 +
docs/html/_static/down-pressed.png | Bin 0 -> 347 bytes
docs/html/_static/down.png | Bin 0 -> 347 bytes
docs/html/_static/file.png | Bin 0 -> 358 bytes
docs/html/_static/jquery-1.11.1.js | 10308 +++++++++++++++++++
docs/html/_static/jquery.js | 4 +
docs/html/_static/minus.png | Bin 0 -> 173 bytes
docs/html/_static/navigation.png | Bin 0 -> 218 bytes
docs/html/_static/plus.png | Bin 0 -> 173 bytes
docs/html/_static/pygments.css | 63 +
docs/html/_static/searchtools.js | 622 ++
docs/html/_static/sphinxdoc.css | 345 +
docs/html/_static/underscore-1.3.1.js | 999 ++
docs/html/_static/underscore.js | 31 +
docs/html/_static/up-pressed.png | Bin 0 -> 345 bytes
docs/html/_static/up.png | Bin 0 -> 345 bytes
docs/html/_static/websupport.js | 808 ++
docs/html/genindex.html | 869 ++
docs/html/index.html | 2465 +++++
docs/html/objects.inv | Bin 0 -> 1177 bytes
docs/html/py-modindex.html | 134 +
docs/html/search.html | 105 +
docs/html/searchindex.js | 1 +
geoip2.egg-info/PKG-INFO | 412 +
geoip2.egg-info/SOURCES.txt | 82 +
geoip2.egg-info/dependency_links.txt | 1 +
geoip2.egg-info/requires.txt | 5 +
geoip2.egg-info/top_level.txt | 1 +
geoip2/__init__.py | 7 +
geoip2/compat.py | 17 +
geoip2/database.py | 199 +
geoip2/errors.py | 51 +
geoip2/mixins.py | 16 +
geoip2/models.py | 472 +
geoip2/records.py | 605 ++
geoip2/webservice.py | 219 +
requirements.txt | 2 +
setup.cfg | 13 +
setup.py | 55 +
tests/__init__.py | 0
tests/data/test-data/GeoIP2-Anonymous-IP-Test.mmdb | Bin 0 -> 3919 bytes
.../GeoIP2-City-Test-Broken-Double-Format.mmdb | Bin 0 -> 20377 bytes
.../GeoIP2-City-Test-Invalid-Node-Count.mmdb | Bin 0 -> 20759 bytes
tests/data/test-data/GeoIP2-City-Test.mmdb | Bin 0 -> 20739 bytes
.../test-data/GeoIP2-Connection-Type-Test.mmdb | Bin 0 -> 3779 bytes
tests/data/test-data/GeoIP2-Country-Test.mmdb | Bin 0 -> 17561 bytes
tests/data/test-data/GeoIP2-Domain-Test.mmdb | Bin 0 -> 6326 bytes
tests/data/test-data/GeoIP2-Enterprise-Test.mmdb | Bin 0 -> 3828 bytes
tests/data/test-data/GeoIP2-ISP-Test.mmdb | Bin 0 -> 76196 bytes
.../data/test-data/GeoIP2-Precision-City-Test.mmdb | Bin 0 -> 21360 bytes
.../data/test-data/GeoIP2-Precision-ISP-Test.mmdb | Bin 0 -> 76443 bytes
.../test-data/MaxMind-DB-no-ipv4-search-tree.mmdb | Bin 0 -> 2251 bytes
.../test-data/MaxMind-DB-string-value-entries.mmdb | Bin 0 -> 1341 bytes
.../MaxMind-DB-test-broken-pointers-24.mmdb | Bin 0 -> 1289 bytes
.../MaxMind-DB-test-broken-search-tree-24.mmdb | Bin 0 -> 1313 bytes
tests/data/test-data/MaxMind-DB-test-decoder.mmdb | Bin 0 -> 3944 bytes
tests/data/test-data/MaxMind-DB-test-ipv4-24.mmdb | Bin 0 -> 1298 bytes
tests/data/test-data/MaxMind-DB-test-ipv4-28.mmdb | Bin 0 -> 1462 bytes
tests/data/test-data/MaxMind-DB-test-ipv4-32.mmdb | Bin 0 -> 1626 bytes
tests/data/test-data/MaxMind-DB-test-ipv6-24.mmdb | Bin 0 -> 2806 bytes
tests/data/test-data/MaxMind-DB-test-ipv6-28.mmdb | Bin 0 -> 3222 bytes
tests/data/test-data/MaxMind-DB-test-ipv6-32.mmdb | Bin 0 -> 3638 bytes
.../MaxMind-DB-test-metadata-pointers.mmdb | Bin 0 -> 2258 bytes
tests/data/test-data/MaxMind-DB-test-mixed-24.mmdb | Bin 0 -> 3066 bytes
tests/data/test-data/MaxMind-DB-test-mixed-28.mmdb | Bin 0 -> 3511 bytes
tests/data/test-data/MaxMind-DB-test-mixed-32.mmdb | Bin 0 -> 3956 bytes
tests/data/test-data/MaxMind-DB-test-nested.mmdb | Bin 0 -> 3802 bytes
tests/database_test.py | 195 +
tests/models_test.py | 345 +
tests/webservice_test.py | 257 +
83 files changed, 21795 insertions(+)
diff --git a/HISTORY.rst b/HISTORY.rst
new file mode 100644
index 0000000..021c2a1
--- /dev/null
+++ b/HISTORY.rst
@@ -0,0 +1,173 @@
+.. :changelog:
+
+History
+-------
+
+2.4.0 (2016-06-10)
+++++++++++++++++++
+
+* This module now uses ``ipaddress`` on Python 2 rather than ``ipaddr`` to
+ validate IP addresses before sending them to the web service.
+* Added handling of additional error codes that the web service may return.
+* PEP 257 documentation fixes.
+* Updated documentation to reflect that the accuracy radius is now included
+ in City.
+* Previously, the source distribution was missing some tests and test
+ databases. This has been corrected. Reported by Lumir Balhar.
+
+2.3.0 (2016-04-15)
+++++++++++++++++++
+
+* Added support for the GeoIP2 Enterprise database.
+* ``geoip2.database.Reader`` now supports being used in a ``with`` statement
+ (PEP 343). (PR from Nguyễn Hồng Quân. GitHub #29)
+
+2.2.0 (2015-06-29)
+++++++++++++++++++
+
+* The ``geoip2.records.Location` class has been updated to add attributes for
+ the ``average_income`` and ``population_density`` fields provided by the
+ Insights web service.
+* The ``is_anonymous_proxy`` and ``is_satellite_provider`` properties on
+ ``geoip2.records.Traits`` have been deprecated. Please use our `GeoIP2
+ Anonymous IP database
+ <https://www.maxmind.com/en/geoip2-anonymous-ip-database>`_
+ to determine whether an IP address is used by an anonymizing service.
+
+2.1.0 (2014-12-09)
+++++++++++++++++++
+
+* The reader now supports pure Python file and memory modes. If you are not
+ using the C extension and your Python does not provide the ``mmap`` module,
+ the file mode will be used by default. You can explicitly set the mode using
+ the ``mode`` keyword argument with the ``MODE_AUTO``, ``MODE_MMAP``,
+ ``MODE_MMAP_EXT``, ``MODE_FILE``, and ``MODE_MEMORY`` constants exported by
+ ``geoip2.database``.
+
+2.0.2 (2014-10-28)
+++++++++++++++++++
+
+* Added support for the GeoIP2 Anonymous IP database. The
+ ``geoip2.database.Reader`` class now has an ``anonymous_ip()`` method which
+ returns a ``geoip2.models.AnonymousIP`` object.
+* Added ``__repr__`` and ``__eq__`` methods to the model and record classes
+ to aid in debugging and using the library from a REPL.
+
+2.0.1 (2014-10-17)
+++++++++++++++++++
+
+* The constructor for ``geoip2.webservice.Client`` now takes an optional
+ ``timeout`` parameter. (PR from arturro. GitHub #15)
+
+2.0.0 (2014-09-22)
+++++++++++++++++++
+
+* First production release.
+
+0.7.0 (2014-09-15)
+++++++++++++++++++
+
+* BREAKING CHANGES:
+ - The deprecated ``city_isp_org()`` and ``omni()`` methods
+ have been removed.
+ - The ``geoip2.database.Reader`` lookup methods (e.g., ``city()``,
+ ``isp()``) now raise a ``TypeError`` if they are used with a database that
+ does not match the method. In particular, doing a ``city()`` lookup on a
+ GeoIP2 Country database will result in an error and vice versa.
+* A ``metadata()`` method has been added to the ``geoip2.database.Reader``
+ class. This returns a ``maxminddb.reader.Metadata`` object with information
+ about the database.
+
+0.6.0 (2014-07-22)
+++++++++++++++++++
+
+* The web service client API has been updated for the v2.1 release of the web
+ service. In particular, the ``city_isp_org`` and ``omni`` methods on
+ ``geoip2.webservice.Client`` should be considered deprecated. The ``city``
+ method now provides all of the data formerly provided by ``city_isp_org``,
+ and the ``omni`` method has been replaced by the ``insights`` method.
+ **Note:** In v2.1 of the web service, ``accuracy_radius``,
+ ``autonomous_system_number``, and all of the ``confidence`` values were
+ changed from unicode to integers. This may affect how you use these values
+ from this API.
+* Support was added for the GeoIP2 Connection Type, Domain, and ISP databases.
+
+0.5.1 (2014-03-28)
+++++++++++++++++++
+
+* Switched to Apache 2.0 license.
+
+0.5.0 (2014-02-11)
+++++++++++++++++++
+
+* Fixed missing import statements for geoip2.errors and geoip2.models.
+ (Gustavo J. A. M. Carneiro)
+* Minor documentation and code cleanup
+* Added requirement for maxminddb v0.3.0, which includes a pure Python
+ database reader. Removed the ``extras_require`` for maxminddb.
+
+0.4.2 (2013-12-20)
+++++++++++++++++++
+
+* Added missing geoip2.models import to geoip.database.
+* Documentation updates.
+
+0.4.1 (2013-10-25)
+++++++++++++++++++
+
+* Read in ``README.rst`` as UTF-8 in ``setup.py``.
+
+0.4.0 (2013-10-21)
+++++++++++++++++++
+
+* API CHANGE: Changed the ``languages`` keyword argument to ``locales`` on the
+ constructors for ``geoip.webservice.Client`` and ``geoip.database.Reader``.
+
+0.3.1 (2013-10-15)
+++++++++++++++++++
+
+* Fixed packaging issue with extras_require.
+
+0.3.0 (2013-10-15)
+++++++++++++++++++
+
+* IMPORTANT: ``geoip.webservices`` was renamed ``geoip.webservice`` as it
+ contains only one class.
+* Added GeoIP2 database reader using ``maxminddb``. This does not work with
+ PyPy as it relies on a C extension.
+* Added more specific exceptions for web service client.
+
+0.2.2 (2013-06-20)
+++++++++++++++++++
+
+* Fixed a bug in the model objects that prevented ``longitude`` and
+ ``metro_code`` from being used.
+
+0.2.1 (2013-06-10)
+++++++++++++++++++
+
+* First official beta release.
+* Documentation updates and corrections.
+
+0.2.0 (2013-05-29)
+++++++++++++++++++
+
+* Support for Python 3.2 was dropped.
+* The methods to call the web service on the ``Client`` object now validate
+ the IP addresses before calling the web service. This requires the
+ ``ipaddr`` module on Python 2.x.
+* We now support more languages. The new languages are de, es, fr, and pt-BR.
+* The REST API now returns a record with data about your account. There is
+ a new geoip.records.MaxMind class for this data.
+* Rename model.continent.continent_code to model.continent.code.
+* Documentation updates.
+
+0.1.1 (2013-05-14)
+++++++++++++++++++
+
+* Documentation and packaging updates
+
+0.1.0 (2013-05-13)
+++++++++++++++++++
+
+* Initial release
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..60f66ef
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,2 @@
+include HISTORY.rst README.rst LICENSE requirements.txt tests/*.py tests/data/test-data/*.mmdb
+graft docs/html
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..bb767a3
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,412 @@
+Metadata-Version: 1.1
+Name: geoip2
+Version: 2.4.0
+Summary: MaxMind GeoIP2 API
+Home-page: http://www.maxmind.com/
+Author: Gregory Oschwald
+Author-email: goschwald at maxmind.com
+License: Apache License, Version 2.0
+Description: =========================
+ MaxMind GeoIP2 Python API
+ =========================
+
+ Description
+ -----------
+
+ This package provides an API for the GeoIP2 `web services
+ <http://dev.maxmind.com/geoip/geoip2/web-services>`_ and `databases
+ <http://dev.maxmind.com/geoip/geoip2/downloadable>`_. The API also works with
+ MaxMind's free `GeoLite2 databases
+ <http://dev.maxmind.com/geoip/geoip2/geolite2/>`_.
+
+ Installation
+ ------------
+
+ To install the ``geoip2`` module, type:
+
+ .. code-block:: bash
+
+ $ pip install geoip2
+
+ If you are not able to use pip, you may also use easy_install from the
+ source directory:
+
+ .. code-block:: bash
+
+ $ easy_install .
+
+ Database Reader Extension
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ If you wish to use the C extension for the database reader, you must first
+ install the `libmaxminddb C API <https://github.com/maxmind/libmaxminddb>`_.
+ Please `see the instructions distributed with it
+ <https://github.com/maxmind/libmaxminddb/blob/master/README.md>`_.
+
+ IP Geolocation Usage
+ --------------------
+
+ IP geolocation is inherently imprecise. Locations are often near the center of
+ the population. Any location provided by a GeoIP2 database or web service
+ should not be used to identify a particular address or household.
+
+ Usage
+ -----
+
+ To use this API, you first create either a web service object with your
+ MaxMind ``user_id`` and ``license_key`` or a database reader object with the
+ path to your database file. After doing this, you may call the method
+ corresponding to request type (e.g., ``city`` or ``country``), passing it the
+ IP address you want to look up.
+
+ If the request succeeds, the method call will return a model class for the
+ end point you called. This model in turn contains multiple record classes,
+ each of which represents part of the data returned by the web service.
+
+ If the request fails, the client class throws an exception.
+
+ Web Service Example
+ -------------------
+
+ .. code-block:: pycon
+
+ >>> import geoip2.webservice
+ >>>
+ >>> # This creates a Client object that can be reused across requests.
+ >>> # Replace "42" with your user ID and "license_key" with your license
+ >>> # key.
+ >>> client = geoip2.webservice.Client(42, 'license_key')
+ >>>
+ >>> # Replace "insights" with the method corresponding to the web service
+ >>> # that you are using, e.g., "country", "city".
+ >>> response = client.insights('128.101.101.101')
+ >>>
+ >>> response.country.iso_code
+ 'US'
+ >>> response.country.name
+ 'United States'
+ >>> response.country.names['zh-CN']
+ u'美国'
+ >>>
+ >>> response.subdivisions.most_specific.name
+ 'Minnesota'
+ >>> response.subdivisions.most_specific.iso_code
+ 'MN'
+ >>>
+ >>> response.city.name
+ 'Minneapolis'
+ >>>
+ >>> response.postal.code
+ '55455'
+ >>>
+ >>> response.location.latitude
+ 44.9733
+ >>> response.location.longitude
+ -93.2323
+
+ Web Service Client Exceptions
+ -----------------------------
+
+ For details on the possible errors returned by the web service itself, see
+ http://dev.maxmind.com/geoip/geoip2/web-services for the GeoIP2 Precision web
+ service docs.
+
+ If the web service returns an explicit error document, this is thrown as a
+ ``AddressNotFoundError``, ``AuthenticationError``, ``InvalidRequestError``, or
+ ``OutOfQueriesError`` as appropriate. These all subclass ``GeoIP2Error``.
+
+ If some other sort of error occurs, this is thrown as an ``HTTPError``. This
+ is thrown when some sort of unanticipated error occurs, such as the web
+ service returning a 500 or an invalid error document. If the web service
+ returns any status code besides 200, 4xx, or 5xx, this also becomes an
+ ``HTTPError``.
+
+ Finally, if the web service returns a 200 but the body is invalid, the client
+ throws a ``GeoIP2Error``.
+
+ Database Example
+ -------------------
+
+ City Database
+ ^^^^^^^^^^^^^
+
+ .. code-block:: pycon
+
+ >>> import geoip2.database
+ >>>
+ >>> # This creates a Reader object. You should use the same object
+ >>> # across multiple requests as creation of it is expensive.
+ >>> reader = geoip2.database.Reader('/path/to/GeoLite2-City.mmdb')
+ >>>
+ >>> # Replace "city" with the method corresponding to the database
+ >>> # that you are using, e.g., "country".
+ >>> response = reader.city('128.101.101.101')
+ >>>
+ >>> response.country.iso_code
+ 'US'
+ >>> response.country.name
+ 'United States'
+ >>> response.country.names['zh-CN']
+ u'美国'
+ >>>
+ >>> response.subdivisions.most_specific.name
+ 'Minnesota'
+ >>> response.subdivisions.most_specific.iso_code
+ 'MN'
+ >>>
+ >>> response.city.name
+ 'Minneapolis'
+ >>>
+ >>> response.postal.code
+ '55455'
+ >>>
+ >>> response.location.latitude
+ 44.9733
+ >>> response.location.longitude
+ -93.2323
+ >>> reader.close()
+
+ Anonymous IP Database
+ ^^^^^^^^^^^^^^^^^^^^^
+
+ .. code-block:: pycon
+
+ >>> import geoip2.database
+ >>>
+ >>> # This creates a Reader object. You should use the same object
+ >>> # across multiple requests as creation of it is expensive.
+ >>> reader = geoip2.database.Reader('/path/to/GeoIP2-Anonymous-IP.mmdb')
+ >>>
+ >>> response = reader.anonymous_ip('85.25.43.84')
+ >>>
+ >>> response.is_anonymous
+ True
+ >>> response.is_anonymous_vpn
+ False
+ >>> response.is_hosting_provider
+ False
+ >>> response.is_public_proxy
+ False
+ >>> response.is_tor_exit_node
+ True
+ >>> response.ip_address
+ '128.101.101.101'
+ >>> reader.close()
+
+ Connection-Type Database
+ ^^^^^^^^^^^^^^^^^^^^^^^^
+
+ .. code-block:: pycon
+
+ >>> import geoip2.database
+ >>>
+ >>> # This creates a Reader object. You should use the same object
+ >>> # across multiple requests as creation of it is expensive.
+ >>> reader = geoip2.database.Reader('/path/to/GeoIP2-Connection-Type.mmdb')
+ >>>
+ >>> response = reader.connection_type('128.101.101.101')
+ >>>
+ >>> response.connection_type
+ 'Corporate'
+ >>> response.ip_address
+ '128.101.101.101'
+ >>> reader.close()
+
+
+ Domain Database
+ ^^^^^^^^^^^^^^^
+
+ .. code-block:: pycon
+
+ >>> import geoip2.database
+ >>>
+ >>> # This creates a Reader object. You should use the same object
+ >>> # across multiple requests as creation of it is expensive.
+ >>> reader = geoip2.database.Reader('/path/to/GeoIP2-Domain.mmdb')
+ >>>
+ >>> response = reader.domain('128.101.101.101')
+ >>>
+ >>> response.domain
+ 'umn.edu'
+ >>> response.ip_address
+ '128.101.101.101'
+ >>> reader.close()
+
+ Enterprise Database
+ ^^^^^^^^^^^^^^^^^^^
+
+ .. code-block:: pycon
+
+ >>> import geoip2.database
+ >>>
+ >>> # This creates a Reader object. You should use the same object
+ >>> # across multiple requests as creation of it is expensive.
+ >>> with geoip2.database.Reader('/path/to/GeoIP2-Enterprise.mmdb') as reader:
+ >>>
+ >>> # Use the .enterprise method to do a lookup in the Enterprise database
+ >>> response = reader.enterprise('128.101.101.101')
+ >>>
+ >>> response.country.confidence
+ 99
+ >>> response.country.iso_code
+ 'US'
+ >>> response.country.name
+ 'United States'
+ >>> response.country.names['zh-CN']
+ u'美国'
+ >>>
+ >>> response.subdivisions.most_specific.name
+ 'Minnesota'
+ >>> response.subdivisions.most_specific.iso_code
+ 'MN'
+ >>> response.subdivisions.most_specific.confidence
+ 77
+ >>>
+ >>> response.city.name
+ 'Minneapolis'
+ >>> response.country.confidence
+ 11
+ >>>
+ >>> response.postal.code
+ '55455'
+ >>>
+ >>> response.location.accuracy_radius
+ 50
+ >>> response.location.latitude
+ 44.9733
+ >>> response.location.longitude
+ -93.2323
+
+ ISP Database
+ ^^^^^^^^^^^^
+
+ .. code-block:: pycon
+
+ >>> import geoip2.database
+ >>>
+ >>> # This creates a Reader object. You should use the same object
+ >>> # across multiple requests as creation of it is expensive.
+ >>> reader = geoip2.database.Reader('/path/to/GeoIP2-ISP.mmdb')
+ >>>
+ >>> response = reader.isp('1.128.0.0')
+ >>>
+ >>> response.autonomous_system_number
+ 1221
+ >>> response.autonomous_system_organization
+ 'Telstra Pty Ltd'
+ >>> response.isp
+ 'Telstra Internet'
+ >>> response.organization
+ 'Telstra Internet'
+ >>> response.ip_address
+ '128.101.101.101'
+ >>> reader.close()
+
+ Database Reader Exceptions
+ --------------------------
+
+ If the database file does not exist or is not readable, a ``ValueError`` will
+ be thrown. If the file is invalid or there is a bug in the reader, a
+ ``maxminddb.InvalidDatabaseError`` will be thrown with a description of the
+ problem. If an IP address is not in the database, a ``AddressNotFoundError``
+ exception will be thrown.
+
+ Values to use for Database or Dictionary Keys
+ ---------------------------------------------
+
+ **We strongly discourage you from using a value from any ``names`` property as
+ a key in a database or dictionaries.**
+
+ These names may change between releases. Instead we recommend using one of the
+ following:
+
+ * ``geoip2.records.City`` - ``city.geoname_id``
+ * ``geoip2.records.Continent`` - ``continent.code`` or ``continent.geoname_id``
+ * ``geoip2.records.Country`` and ``geoip2.records.RepresentedCountry`` - ``country.iso_code`` or ``country.geoname_id``
+ * ``geoip2.records.subdivision`` - ``subdivision.iso_code`` or ``subdivision.geoname_id``
+
+ What data is returned?
+ ----------------------
+
+ While many of the models contain the same basic records, the attributes which
+ can be populated vary between web service end points or databases. In
+ addition, while a model may offer a particular piece of data, MaxMind does not
+ always have every piece of data for any given IP address.
+
+ Because of these factors, it is possible for any request to return a record
+ where some or all of the attributes are unpopulated.
+
+ The only piece of data which is always returned is the ``ip_address``
+ attribute in the ``geoip2.records.Traits`` record.
+
+ Integration with GeoNames
+ -------------------------
+
+ `GeoNames <http://www.geonames.org/>`_ offers web services and downloadable
+ databases with data on geographical features around the world, including
+ populated places. They offer both free and paid premium data. Each feature is
+ uniquely identified by a ``geoname_id``, which is an integer.
+
+ Many of the records returned by the GeoIP web services and databases include a
+ ``geoname_id`` field. This is the ID of a geographical feature (city, region,
+ country, etc.) in the GeoNames database.
+
+ Some of the data that MaxMind provides is also sourced from GeoNames. We
+ source things like place names, ISO codes, and other similar data from the
+ GeoNames premium data set.
+
+ Reporting Data Problems
+ -----------------------
+
+ If the problem you find is that an IP address is incorrectly mapped, please
+ `submit your correction to MaxMind <http://www.maxmind.com/en/correction>`_.
+
+ If you find some other sort of mistake, like an incorrect spelling, please
+ check the `GeoNames site <http://www.geonames.org/>`_ first. Once you've
+ searched for a place and found it on the GeoNames map view, there are a
+ number of links you can use to correct data ("move", "edit", "alternate
+ names", etc.). Once the correction is part of the GeoNames data set, it
+ will be automatically incorporated into future MaxMind releases.
+
+ If you are a paying MaxMind customer and you're not sure where to submit a
+ correction, please `contact MaxMind support
+ <http://www.maxmind.com/en/support>`_ for help.
+
+ Requirements
+ ------------
+
+ This code requires Python 2.6+ or 3.3+. Older versions are not supported.
+ This library has been tested with CPython and PyPy.
+
+ The Requests HTTP library is also required. See
+ <http://python-requests.org> for details.
+
+ Versioning
+ ----------
+
+ The GeoIP2 Python API uses `Semantic Versioning <http://semver.org/>`_.
+
+ Support
+ -------
+
+ Please report all issues with this code using the `GitHub issue tracker
+ <https://github.com/maxmind/GeoIP2-python/issues>`_
+
+ If you are having an issue with a MaxMind service that is not specific to the
+ client API, please contact `MaxMind support
+ <http://www.maxmind.com/en/support>`_ for assistance.
+
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Web Environment
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: System Administrators
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python
+Classifier: Topic :: Internet :: Proxy Servers
+Classifier: Topic :: Internet
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..7dce8ce
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,389 @@
+=========================
+MaxMind GeoIP2 Python API
+=========================
+
+Description
+-----------
+
+This package provides an API for the GeoIP2 `web services
+<http://dev.maxmind.com/geoip/geoip2/web-services>`_ and `databases
+<http://dev.maxmind.com/geoip/geoip2/downloadable>`_. The API also works with
+MaxMind's free `GeoLite2 databases
+<http://dev.maxmind.com/geoip/geoip2/geolite2/>`_.
+
+Installation
+------------
+
+To install the ``geoip2`` module, type:
+
+.. code-block:: bash
+
+ $ pip install geoip2
+
+If you are not able to use pip, you may also use easy_install from the
+source directory:
+
+.. code-block:: bash
+
+ $ easy_install .
+
+Database Reader Extension
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+If you wish to use the C extension for the database reader, you must first
+install the `libmaxminddb C API <https://github.com/maxmind/libmaxminddb>`_.
+Please `see the instructions distributed with it
+<https://github.com/maxmind/libmaxminddb/blob/master/README.md>`_.
+
+IP Geolocation Usage
+--------------------
+
+IP geolocation is inherently imprecise. Locations are often near the center of
+the population. Any location provided by a GeoIP2 database or web service
+should not be used to identify a particular address or household.
+
+Usage
+-----
+
+To use this API, you first create either a web service object with your
+MaxMind ``user_id`` and ``license_key`` or a database reader object with the
+path to your database file. After doing this, you may call the method
+corresponding to request type (e.g., ``city`` or ``country``), passing it the
+IP address you want to look up.
+
+If the request succeeds, the method call will return a model class for the
+end point you called. This model in turn contains multiple record classes,
+each of which represents part of the data returned by the web service.
+
+If the request fails, the client class throws an exception.
+
+Web Service Example
+-------------------
+
+.. code-block:: pycon
+
+ >>> import geoip2.webservice
+ >>>
+ >>> # This creates a Client object that can be reused across requests.
+ >>> # Replace "42" with your user ID and "license_key" with your license
+ >>> # key.
+ >>> client = geoip2.webservice.Client(42, 'license_key')
+ >>>
+ >>> # Replace "insights" with the method corresponding to the web service
+ >>> # that you are using, e.g., "country", "city".
+ >>> response = client.insights('128.101.101.101')
+ >>>
+ >>> response.country.iso_code
+ 'US'
+ >>> response.country.name
+ 'United States'
+ >>> response.country.names['zh-CN']
+ u'美国'
+ >>>
+ >>> response.subdivisions.most_specific.name
+ 'Minnesota'
+ >>> response.subdivisions.most_specific.iso_code
+ 'MN'
+ >>>
+ >>> response.city.name
+ 'Minneapolis'
+ >>>
... 21309 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-geoip2.git
More information about the Python-modules-commits
mailing list