def __getitem__(self, key):
if isinstance(key, str):<EOL><INDENT>if key.lower() in general.request_methods:<EOL><INDENT>return self._request(key)<EOL><DEDENT>else:<EOL><INDENT>new_path = self._path + [key]<EOL><DEDENT><DEDENT>elif isinstance(key, (tuple, list)):<EOL><INDENT>key = [str(i) for i in key]<EOL>new_path = self._path + key<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>" % (key, type(key)))<EOL><DEDENT>return self.__class__(path=new_path,<EOL>suffix=self._suffix,<EOL>client=self.client)<EOL>
Where the magic happens

If the key is a request method (eg. get) call the _request
attribute with the method as argument

otherwise append the key to the _path attribute

>>> api = APIPath()  # you would have to add more arguments
>>> api['client']    # appends 'client' to _path

Parameters
----------
key : :obj:`str`, :obj:`tuple` or :obj:`list`
    Key used to access an API endpoint and appended to the
    path attribute

Returns
-------
BaseAPIPath
    New APIPath instance with a new ``path`` value