Search code examples
pythonwikiwikimapia

Wikimapia API for Python (PyMapia)


I am trying to use pymapia API for Wikimapia made for Python and not able to understand about how to use it properly.

import pymapia as PyMapia
a = PyMapia.PyMapia.get_all_categories()

It gives me the error as following.

TypeError: unbound method get_all_categories() must be called with PyMapia instance as first argument (got nothing instead)

I am not sure whether I am using it properly with all arguments. I have also generated the key for it.


Solution

  • pymapia.PyMapia is a class. You need to create an object which is an instance that class, and then call the object's methods.

    Try this:

    #UNTESTED
    
    import pymapia as PyMapia
    session = PyMapia.PyMapia("Your_Api_Key_Goes_Here")
    a = session.get_all_categories()