There are broadly two options for using seshypy. First, you can use it to create clients for calling API Gateway via specific method calls. For example, if you have a library catalog application, you could have a books session, that has the methods, get_books, post_book, etc. Those methods would know the route and make the call accordingly.

The second method, is to use it as a very client, that only manages your session. In that case, you simply create a base_session, then make the calls like, sess.get(“books/”) or“books/”, json=book_data).

Method 1 - specific client methods

from builtins import super
from seshypy.base_session import BaseSession

class BookSession(BaseSession):
    """Api Gateway Calls and Helper Methods Pertaining to /books routes """
    def __init__(self, cache_methods=None, *args, **kwargs):
        cache_methods = cache_methods if cache_methods is not None else [
        super().__init__(cache_methods=cache_methods, *args, **kwargs)

    def get_books(self):
        """Get books.

            list: boooks
        path = 'books/'
        return self.get(path).json()
from client import BookSession
session = BookSession("", **creds)
books = session.get_books()

Method 2 - thin API method wrapper

from seshypy import BaseSession
session = BaseSession("", **creds)
books = session.get("books/").json()