Files
Hippolyzer/docs/highlevelapi.txt
2008-08-01 21:52:19 +00:00

59 lines
1.7 KiB
Plaintext

==================
The High Level API
==================
Initializing the framework
--------------------------
Before you can do anything you need to initialize the library. You do this
by importing all the needed parts and calling the 'init()' method::
>>> from pyogp.lib.base import init
>>> def my_app():
... init()
... # now do something
>>> my_app()
Login to an Agent Domain
------------------------
The login to an Agent Domain is the first thing you do. There is one login method for use
with a plain password. To use it give it the login_uri, firstname, lastname and the plain password::
>>> from pyogp.lib.base.api import *
>>> agent = login_with_plainpassword("http://localhost:12345/","Firstname","Lastname","secret")
Now you have an agent object which you can use further.
For instance you can access the agentdomain object of it::
>>> agent.agentdomain
<pyogp.lib.base.agentdomain.AgentDomain object at ...>
The agentdomain object represents the endpoint of the agent domain you connected to. Usually you
should not need it though in the high level API.
Placing an avatar on a region
-----------------------------
Now can place your agent on a region. The agent's representation is called an avatar. This is
what you will get back from the place_avatar function which you give the region uri of the
Region you want to place it on::
>>> avatar = place_avatar(agent, "http://localhost:12345/region")
Now you have an avatar object which you can use further to interact with the region.
It also stores the region object on which it currently is. You can access it like this::
>>> avatar.region
<pyogp.lib.base.regiondomain.Region object at ...>
But as with the agent domain you usually should not need this.