pysyge
======
http://github.com/idlesign/pysyge
|release| |lic| |coverage|
.. |release| image:: https://img.shields.io/pypi/v/pysyge.svg
:target: https://pypi.python.org/pypi/pysyge
.. |lic| image:: https://img.shields.io/pypi/l/pysyge.svg
:target: https://pypi.python.org/pypi/pysyge
.. |coverage| image:: https://img.shields.io/coveralls/idlesign/pysyge/master.svg
:target: https://coveralls.io/r/idlesign/pysyge
What's that
-----------
*pysyge is an API to access data from Sypex Geo IP database files from your Python code.*
For more information about Sypex Geo databases and their features please visit http://sypexgeo.net.
Direct DB link that might became broken over time:
* Sypex Geo City DB - http://sypexgeo.net/files/SxGeoCity_utf8.zip
Requirements
------------
* Python 3.6+
Attention
---------
1. This version of pysyge works with **Sypex Geo DB version 2.2 or above**.
The structure of a dictionary returned by GeoLocator.get_location() was preserved in a backward compatible manner
as much as possible, yet it's advised to update your code to use data from `info` sub dictionary.
2. This version of pysyge works with **UTF-8** Sypex Geo Databases. Texts returned by pysyge are **UTF-8**.
Quickstart
----------
Download Geo IP database file from http://sypexgeo.net/ (example below uses ``SxGeoCityMax.dat`` file).
Application sample
.. code-block:: python
# Import all we need from pysyge module.
from pysyge import GeoLocator, MODE_BATCH, MODE_MEMORY
# Create GeoLocator object to access API
# from 'SxGeoCityMax.dat' using fast memory mode.
geodata = GeoLocator('SxGeoCityMax.dat', MODE_BATCH | MODE_MEMORY)
# Let's get some meta information.
print('DB version %s (%s)' % (geodata.get_db_version(), geodata.get_db_date()))
# Request geo information for 77.88.21.3 IP address.
# Getting detailed information, including region info.
location = geodata.get_location('77.88.21.3', detailed=True)
# Print out some lyrics.
# Most interesting data is under `info` in `city`, `country` and `region` dictionaries
print('%s (%s) calling. All the circuits are busy.' % (
location['info']['city']['name_en'], location['info']['country']['iso']))
Raw data
{
"_id": null,
"home_page": "http://github.com/idlesign/pysyge",
"name": "pysyge",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Igor `idle sign` Starikov",
"author_email": "idlesign@yandex.ru",
"download_url": "https://files.pythonhosted.org/packages/2f/38/bb54dd298e11bdfadafce4d5cb1f82e72df91283d1ad7b7ee37759d66308/pysyge-1.2.1.tar.gz",
"platform": null,
"description": "pysyge\n======\nhttp://github.com/idlesign/pysyge\n\n|release| |lic| |coverage|\n\n.. |release| image:: https://img.shields.io/pypi/v/pysyge.svg\n :target: https://pypi.python.org/pypi/pysyge\n\n.. |lic| image:: https://img.shields.io/pypi/l/pysyge.svg\n :target: https://pypi.python.org/pypi/pysyge\n\n.. |coverage| image:: https://img.shields.io/coveralls/idlesign/pysyge/master.svg\n :target: https://coveralls.io/r/idlesign/pysyge\n\n\n\nWhat's that\n-----------\n\n*pysyge is an API to access data from Sypex Geo IP database files from your Python code.*\n\nFor more information about Sypex Geo databases and their features please visit http://sypexgeo.net.\n\nDirect DB link that might became broken over time:\n\n * Sypex Geo City DB - http://sypexgeo.net/files/SxGeoCity_utf8.zip\n\n\n\nRequirements\n------------\n\n* Python 3.6+\n\n\n\nAttention\n---------\n\n1. This version of pysyge works with **Sypex Geo DB version 2.2 or above**.\n\n The structure of a dictionary returned by GeoLocator.get_location() was preserved in a backward compatible manner\n as much as possible, yet it's advised to update your code to use data from `info` sub dictionary.\n\n2. This version of pysyge works with **UTF-8** Sypex Geo Databases. Texts returned by pysyge are **UTF-8**.\n\n\n\nQuickstart\n----------\n\nDownload Geo IP database file from http://sypexgeo.net/ (example below uses ``SxGeoCityMax.dat`` file).\n\nApplication sample\n\n.. code-block:: python\n\n # Import all we need from pysyge module.\n from pysyge import GeoLocator, MODE_BATCH, MODE_MEMORY\n\n # Create GeoLocator object to access API\n # from 'SxGeoCityMax.dat' using fast memory mode.\n geodata = GeoLocator('SxGeoCityMax.dat', MODE_BATCH | MODE_MEMORY)\n\n # Let's get some meta information.\n print('DB version %s (%s)' % (geodata.get_db_version(), geodata.get_db_date()))\n\n # Request geo information for 77.88.21.3 IP address.\n # Getting detailed information, including region info.\n location = geodata.get_location('77.88.21.3', detailed=True)\n\n # Print out some lyrics.\n # Most interesting data is under `info` in `city`, `country` and `region` dictionaries\n print('%s (%s) calling. All the circuits are busy.' % (\n location['info']['city']['name_en'], location['info']['country']['iso']))\n\n\n\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License",
"summary": "API to access data from Sypex Geo IP database files from your Python code",
"version": "1.2.1",
"project_urls": {
"Homepage": "http://github.com/idlesign/pysyge"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e7a3dbfe36ee212574b730d8c5b3b22b012b66bcf1a46063984ac08b91b91619",
"md5": "2c5da31500a60f5cc2f2137b5b25281c",
"sha256": "3254ad2171aaad5417ba7d71d843923a1d32671af35dc9fd973cdb41b2d50f5a"
},
"downloads": -1,
"filename": "pysyge-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c5da31500a60f5cc2f2137b5b25281c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8024,
"upload_time": "2024-03-08T08:43:13",
"upload_time_iso_8601": "2024-03-08T08:43:13.547655Z",
"url": "https://files.pythonhosted.org/packages/e7/a3/dbfe36ee212574b730d8c5b3b22b012b66bcf1a46063984ac08b91b91619/pysyge-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2f38bb54dd298e11bdfadafce4d5cb1f82e72df91283d1ad7b7ee37759d66308",
"md5": "a8c05f60347bdcf9fa9bfd02adb30430",
"sha256": "3f35a5f92dc1136c15543076bdc1305f3314f237d5f9b780c26d788d5cb83f89"
},
"downloads": -1,
"filename": "pysyge-1.2.1.tar.gz",
"has_sig": false,
"md5_digest": "a8c05f60347bdcf9fa9bfd02adb30430",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 23499988,
"upload_time": "2024-03-08T08:43:22",
"upload_time_iso_8601": "2024-03-08T08:43:22.260825Z",
"url": "https://files.pythonhosted.org/packages/2f/38/bb54dd298e11bdfadafce4d5cb1f82e72df91283d1ad7b7ee37759d66308/pysyge-1.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-08 08:43:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "idlesign",
"github_project": "pysyge",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "pysyge"
}