GuildWars2-API-Client


NameGuildWars2-API-Client JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://github.com/JuxhinDB/gw2-api-interface
SummaryLibrary that interfaces with the Guild Wars 2 API that supports v1 and v2
upload_time2023-08-24 08:38:23
maintainer
docs_urlNone
authorJDB
requires_python
licenseMIT
keywords guildwars 2 api gw2
VCS
bugtrack_url
requirements No requirements were recorded.
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
^^^^^^^^^^^^^^^^^^

WIP


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": "https://github.com/JuxhinDB/gw2-api-interface",
    "name": "GuildWars2-API-Client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "guildwars 2,api,gw2",
    "author": "JDB",
    "author_email": "JuxhinBox@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a5/c3/7725188b6f89dbaff6ed7c93edd2aa83ede21a5067e7379fd7208c2c71b0/GuildWars2-API-Client-0.6.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\nWIP\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",
    "summary": "Library that interfaces with the Guild Wars 2 API that supports v1 and v2",
    "version": "0.6.0",
    "project_urls": {
        "Homepage": "https://github.com/JuxhinDB/gw2-api-interface"
    },
    "split_keywords": [
        "guildwars 2",
        "api",
        "gw2"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "795a222bef2d919a11211f8499d071efbc78c8f803d7d5f47051aab2d55c081f",
                "md5": "d9c0322803bc360e256bffe9e84fd3e8",
                "sha256": "8adc17cdd46553c8621b729afae243803c1f9e0f15e70974fe851e341dc74136"
            },
            "downloads": -1,
            "filename": "GuildWars2_API_Client-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d9c0322803bc360e256bffe9e84fd3e8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 16394,
            "upload_time": "2023-08-24T08:38:22",
            "upload_time_iso_8601": "2023-08-24T08:38:22.293020Z",
            "url": "https://files.pythonhosted.org/packages/79/5a/222bef2d919a11211f8499d071efbc78c8f803d7d5f47051aab2d55c081f/GuildWars2_API_Client-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a5c37725188b6f89dbaff6ed7c93edd2aa83ede21a5067e7379fd7208c2c71b0",
                "md5": "8aeef607ee72642d54fcf095d8da1b05",
                "sha256": "233f950d20220198d266923968084faa9adfb8142769011e703673b64e2b81db"
            },
            "downloads": -1,
            "filename": "GuildWars2-API-Client-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8aeef607ee72642d54fcf095d8da1b05",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17784,
            "upload_time": "2023-08-24T08:38:23",
            "upload_time_iso_8601": "2023-08-24T08:38:23.687457Z",
            "url": "https://files.pythonhosted.org/packages/a5/c3/7725188b6f89dbaff6ed7c93edd2aa83ede21a5067e7379fd7208c2c71b0/GuildWars2-API-Client-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-24 08:38:23",
    "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": [],
    "lcname": "guildwars2-api-client"
}
        
JDB
Elapsed time: 0.10502s