Name | GuildWars2-API-Client JSON |
Version |
0.7.0
JSON |
| download |
home_page | None |
Summary | Library that interfaces with the Guild Wars 2 API that supports v1 and v2 |
upload_time | 2024-12-30 11:55:09 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | MIT License Copyright (c) 2017 JDB Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
guildwars
api
gw2
|
VCS |
 |
bugtrack_url |
|
requirements |
pytest
sphinx
requests
requests-mock
|
Travis-CI |
|
coveralls test coverage |
No coveralls.
|
.. figure:: https://raw.githubusercontent.com/JuxhinDB/gw2-api-interface/master/res/images/gw2-banner.jpg
:alt: Guild Wars 2 Banner
--------------
GuildWars2 API Client
=====================
|Build Status|
Library that interfaces with the Guild Wars 2 API that supports v1
and v2 - https://wiki.guildwars2.com/wiki/API:Main
Table of Contents
=================
- `Pre-requisites <#prerequisites>`__
- `Installation <#installation>`__
- `Usage <#usage>`__
- `Basic Usage <#basic-usage>`__
- `Advanced Usage <#advanced-usage>`__
- `API Objects <#api-objects>`__
- `Client Settings <#client-settings>`__
- `Proxy and SSL <#proxy-and-ssl>`__
- `Authenticated Endpoints <#authenticated-endpoints>`__
- `Cursors and Limits <#cursors-and-limits>`__
- `Examples <#examples>`__
Prerequisites
-------------
- Python v3.4 or higher
Installation
------------
See PyPi package `here <https://pypi.org/project/GuildWars2-API-Client/>`_:
::
pip install GuildWars2-API-Client
::
pip install git+https://github.com/JuxhinDB/gw2-api-interface.git#egg=gw2api
Usage
-----
Basic Usage
^^^^^^^^^^^
Initializing a default client is simple. The following default values
will be automatically set for you:
- API URL: https://api.guildwars2.com
- Version: 2
- Lang: en
Thus you can create a basic client like so:
.. code-block:: python
from gw2api import GuildWars2Client
gw2_client = GuildWars2Client()
The format for accessing an object will always be
``{client}.{object}.get()``. For example:
.. code-block:: python
gw2_client.build.get()
::
81583
Advanced Usage
^^^^^^^^^^^^^^
**API Objects**
The client will automatically expose all the API objects available
depending on the API version. This can be done by calling the ``dir()``
method on the client object, like so:
.. code-block:: python
gw2_client = GuildWars2Client(version='v1')
dir(gw2_client)
::
['BASE_URL', 'LANG', 'VERSION',
'api_key', 'base_url', 'build', 'colors', 'continents', 'eventdetails',
'files', 'guilddetails', 'itemdetails', 'items', 'lang', 'mapfloor',
'mapnames', 'maps', 'proxy', 'recipedetails', 'recipes', 'session',
'skindetails', 'skins', 'verify_ssl', 'version', 'worldnames',
'wvwmatchdetails', 'wvwmatches', 'wvwobjectivenames']
All redundant protocol-methods (i.e. ``__repr__``) were removed from the
output, you can ofcourse see the full output when running this in your
project.
**Client Settings**
To examine the client settings at any given point, simply print the
object.
.. code-block:: python
from gw2api import GuildWars2Client
gw2_client = GuildWars2Client()
gw2_client
::
<GuildWars2Client https://api.guildwars2.com
Version: v2
API Key: None
Language: en
Proxy: None
Verify SSL?: True>
**Proxy and SSL**
If at any given point you need to pass API requests through proxy (e.g.
Fiddler) you can configure the client to pass all request through said
proxy during client initialization.
.. code-block:: python
from gw2api import GuildWars2Client
gw2_client = GuildWars2Client(proxy={'http': '127.0.0.1:8888', 'https': '127.0.0.1:8888'}, version='v1'})
Additionally if you're passing through a local proxy, you may need to
set SSL verification to false like so:
.. code-block:: python
from gw2api import GuildWars2Client
gw2_client = GuildWars2Client(proxy={'http': '127.0.0.1:8888', 'https': '127.0.0.1:8888'}, version='v1', verify_ssl=False)
Authenticated Endpoints
^^^^^^^^^^^^^^^^^^^^^^^
There may be cases where certain endpoints such as ``Accounts`` or
``Guild`` related endpoints may require authentication. This is
generally configured on initialization of the client, like so:
.. code-block:: python
client = GuildWars2Client(api_key='API_KEY_VALUE_HERE')
If you want to generate your own API key, please refer to the following
`link <https://account.arena.net/applications>`__.
Cursors and Limits
^^^^^^^^^^^^^^^^^^
Currently unimplemented. If you require cursors & limits, a PR is greatly appreciated. I will be
able to mentor you on the implementation if/when needed.
Examples
~~~~~~~~
Below are a few examples and one-liners that may help when testing or
debugging the project:
**Using** `Fiddler <http://www.telerik.com/fiddler>`__:
.. code-block:: python
from gw2api import GuildWars2Client
client = GuildWars2Client(proxy={'http': '127.0.0.1:8888', 'https': '127.0.0.1:8888'}, verify_ssl=False, api_key='API_KEY')
**APIv2 Searching for Guild**
.. code-block:: python
client.guildsearch.get(name='Mythical Realms')
::
0CB3B1A7-4C70-E611-80D3-E4115BE8BBE8
**APIv2 Retrieving guild members**
.. code-block:: python
client.guildidmembers.get('0CB3B1A7-4C70-E611-80D3-E4115BE8BBE8')
::
{"text": "access restricted to guild leaders"} # :-(
.. |Build Status| image:: https://travis-ci.org/JuxhinDB/gw2-api-interface.svg?branch=feature%2Fapi-requests
:target: https://travis-ci.org/JuxhinDB/gw2-api-interface
Raw data
{
"_id": null,
"home_page": null,
"name": "GuildWars2-API-Client",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "guildwars, api, gw2",
"author": null,
"author_email": "juxhin <juxhin@digital-horror.com>",
"download_url": "https://files.pythonhosted.org/packages/49/3a/dc1bb6c1ce4960c4c7c150ea0bd415504ae7067c394d2fcf723772e11b2a/guildwars2_api_client-0.7.0.tar.gz",
"platform": null,
"description": "\n.. figure:: https://raw.githubusercontent.com/JuxhinDB/gw2-api-interface/master/res/images/gw2-banner.jpg\n :alt: Guild Wars 2 Banner\n\n--------------\n\n\nGuildWars2 API Client\n=====================\n\n|Build Status|\n\n Library that interfaces with the Guild Wars 2 API that supports v1\n and v2 - https://wiki.guildwars2.com/wiki/API:Main\n\n \nTable of Contents\n=================\n\n- `Pre-requisites <#prerequisites>`__\n- `Installation <#installation>`__\n- `Usage <#usage>`__\n\n - `Basic Usage <#basic-usage>`__\n - `Advanced Usage <#advanced-usage>`__\n\n - `API Objects <#api-objects>`__\n - `Client Settings <#client-settings>`__\n - `Proxy and SSL <#proxy-and-ssl>`__\n\n - `Authenticated Endpoints <#authenticated-endpoints>`__\n - `Cursors and Limits <#cursors-and-limits>`__\n\n- `Examples <#examples>`__\n\n\nPrerequisites\n-------------\n\n- Python v3.4 or higher\n\n\nInstallation\n------------\n\nSee PyPi package `here <https://pypi.org/project/GuildWars2-API-Client/>`_:\n\n::\n\n pip install GuildWars2-API-Client\n\n::\n\n pip install git+https://github.com/JuxhinDB/gw2-api-interface.git#egg=gw2api\n\n\n\nUsage\n-----\n\n\nBasic Usage\n^^^^^^^^^^^\n\nInitializing a default client is simple. The following default values\nwill be automatically set for you:\n\n- API URL: https://api.guildwars2.com\n- Version: 2\n- Lang: en\n\nThus you can create a basic client like so:\n\n.. code-block:: python\n\n from gw2api import GuildWars2Client\n\n gw2_client = GuildWars2Client()\n\nThe format for accessing an object will always be\n``{client}.{object}.get()``. For example:\n\n.. code-block:: python\n\n gw2_client.build.get()\n\n::\n\n 81583\n\n\nAdvanced Usage\n^^^^^^^^^^^^^^\n\n\n**API Objects**\n\nThe client will automatically expose all the API objects available\ndepending on the API version. This can be done by calling the ``dir()``\nmethod on the client object, like so:\n\n.. code-block:: python\n\n gw2_client = GuildWars2Client(version='v1')\n dir(gw2_client)\n\n::\n\n ['BASE_URL', 'LANG', 'VERSION',\n 'api_key', 'base_url', 'build', 'colors', 'continents', 'eventdetails',\n 'files', 'guilddetails', 'itemdetails', 'items', 'lang', 'mapfloor',\n 'mapnames', 'maps', 'proxy', 'recipedetails', 'recipes', 'session',\n 'skindetails', 'skins', 'verify_ssl', 'version', 'worldnames',\n 'wvwmatchdetails', 'wvwmatches', 'wvwobjectivenames']\n\nAll redundant protocol-methods (i.e. ``__repr__``) were removed from the\noutput, you can ofcourse see the full output when running this in your\nproject.\n\n\n**Client Settings**\n\nTo examine the client settings at any given point, simply print the\nobject.\n\n.. code-block:: python\n\n from gw2api import GuildWars2Client\n gw2_client = GuildWars2Client()\n\n gw2_client\n\n::\n\n <GuildWars2Client https://api.guildwars2.com\n Version: v2\n API Key: None\n Language: en\n Proxy: None\n Verify SSL?: True>\n\n\n**Proxy and SSL**\n\nIf at any given point you need to pass API requests through proxy (e.g.\nFiddler) you can configure the client to pass all request through said\nproxy during client initialization.\n\n.. code-block:: python\n\n from gw2api import GuildWars2Client\n gw2_client = GuildWars2Client(proxy={'http': '127.0.0.1:8888', 'https': '127.0.0.1:8888'}, version='v1'})\n\nAdditionally if you're passing through a local proxy, you may need to\nset SSL verification to false like so:\n\n.. code-block:: python\n\n from gw2api import GuildWars2Client\n gw2_client = GuildWars2Client(proxy={'http': '127.0.0.1:8888', 'https': '127.0.0.1:8888'}, version='v1', verify_ssl=False)\n\n\nAuthenticated Endpoints\n^^^^^^^^^^^^^^^^^^^^^^^\n\nThere may be cases where certain endpoints such as ``Accounts`` or\n``Guild`` related endpoints may require authentication. This is\ngenerally configured on initialization of the client, like so:\n\n.. code-block:: python\n\n client = GuildWars2Client(api_key='API_KEY_VALUE_HERE')\n\nIf you want to generate your own API key, please refer to the following\n`link <https://account.arena.net/applications>`__.\n\n\nCursors and Limits\n^^^^^^^^^^^^^^^^^^\n\nCurrently unimplemented. If you require cursors & limits, a PR is greatly appreciated. I will be \nable to mentor you on the implementation if/when needed.\n\n\nExamples\n~~~~~~~~\n\nBelow are a few examples and one-liners that may help when testing or\ndebugging the project:\n\n\n**Using** `Fiddler <http://www.telerik.com/fiddler>`__:\n\n.. code-block:: python\n\n from gw2api import GuildWars2Client\n client = GuildWars2Client(proxy={'http': '127.0.0.1:8888', 'https': '127.0.0.1:8888'}, verify_ssl=False, api_key='API_KEY')\n\n\n**APIv2 Searching for Guild**\n\n.. code-block:: python\n\n client.guildsearch.get(name='Mythical Realms')\n\n::\n\n 0CB3B1A7-4C70-E611-80D3-E4115BE8BBE8\n\n\n**APIv2 Retrieving guild members**\n\n.. code-block:: python\n\n client.guildidmembers.get('0CB3B1A7-4C70-E611-80D3-E4115BE8BBE8')\n\n::\n\n {\"text\": \"access restricted to guild leaders\"} # :-(\n\n\n.. |Build Status| image:: https://travis-ci.org/JuxhinDB/gw2-api-interface.svg?branch=feature%2Fapi-requests\n :target: https://travis-ci.org/JuxhinDB/gw2-api-interface\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2017 JDB Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Library that interfaces with the Guild Wars 2 API that supports v1 and v2",
"version": "0.7.0",
"project_urls": {
"Home": "https://github.com/JuxhinDB/gw2-api-interface"
},
"split_keywords": [
"guildwars",
" api",
" gw2"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d4882ee3b2fbee2200fc3d72599feafc5780e97d740933ff9bb278e198460829",
"md5": "7fa200f78ef7095784013b9068ad959a",
"sha256": "1671dca0119a073a87b8c56538978585a8ef0d50f5d4117b3d5060ba87676900"
},
"downloads": -1,
"filename": "GuildWars2_API_Client-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7fa200f78ef7095784013b9068ad959a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 16321,
"upload_time": "2024-12-30T11:55:06",
"upload_time_iso_8601": "2024-12-30T11:55:06.990979Z",
"url": "https://files.pythonhosted.org/packages/d4/88/2ee3b2fbee2200fc3d72599feafc5780e97d740933ff9bb278e198460829/GuildWars2_API_Client-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "493adc1bb6c1ce4960c4c7c150ea0bd415504ae7067c394d2fcf723772e11b2a",
"md5": "85bc7a474b7f38d812c97e47b0bbbd87",
"sha256": "7b3f8044a5717fcf42fb9c683b1bf845a353746bd019c520586d99f5ecf1abf4"
},
"downloads": -1,
"filename": "guildwars2_api_client-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "85bc7a474b7f38d812c97e47b0bbbd87",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 18288,
"upload_time": "2024-12-30T11:55:09",
"upload_time_iso_8601": "2024-12-30T11:55:09.576499Z",
"url": "https://files.pythonhosted.org/packages/49/3a/dc1bb6c1ce4960c4c7c150ea0bd415504ae7067c394d2fcf723772e11b2a/guildwars2_api_client-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-30 11:55:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "JuxhinDB",
"github_project": "gw2-api-interface",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "pytest",
"specs": []
},
{
"name": "sphinx",
"specs": []
},
{
"name": "requests",
"specs": []
},
{
"name": "requests-mock",
"specs": []
}
],
"lcname": "guildwars2-api-client"
}