seshypy documentation¶
Contents:
seshypy¶
seshypy makes API Gateway requests and API Gateway clients easy.¶
Features¶
- Make API Gateway signed requests.
- Helper methods for delete, get, post, and put.
- Permanent STS hops creds creds resolver.
- Session sharing.
- Method caching with TTL.
- given secrets
- resolved from shared credential) (using transparent STS or secrets)
- given role (using shared credentials)
- given secrets and role
- Multiple authentication methods.
Documentation¶
Documentation can be found at https://seshypy.readthedocs.io/.
Installation¶
Stable release¶
To install seshypy, run this command in your terminal:
$ pip install seshypy
This is the preferred method to install, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
From sources¶
The sources for howsitgoing can be downloaded from the Github repo.
Clone the repository:
$ git clone git@github.com:cleardataeng/seshypy.git
Once you have a copy of the source, you can install it with:
$ python setup.py install
Usage¶
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 sess.post(“books/”, json=book_data).
Method 1 - specific client methods¶
# client.py
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 [
'get_books',
]
super().__init__(cache_methods=cache_methods, *args, **kwargs)
def get_books(self):
"""Get books.
Returns:
list: boooks
"""
path = 'books/'
return self.get(path).json()
# caller.py
from client import BookSession
session = BookSession("https://yourapi.com", **creds)
books = session.get_books()
Method 2 - thin API method wrapper¶
# caller.py
from seshypy import BaseSession
session = BaseSession("https://yourapi.com", **creds)
books = session.get("books/").json()
Contributing¶
Contribution are welcome. You can contribute in the following ways.
- report bugs
- fix bugs
- implement features
- write documentation
- submit feedback
Get Started¶
Pull / Merge Request Guidelines¶
Credits¶
Core Developers¶
- John Bloom john.s.bloom@gmail.com
- Jeffrey DeFond jeff.defond@cleardata.com
- Adam Sherwood theherk@gmail.com
Contributors¶
- David Lee david.lee@cleardata.com
- Byron Mann byronosity@gmail.com
- Manoli Yiannakakis manoli.yiannakakis@cleardata.com