PK!_H88 LICENSE.txtThe MIT License (MIT) Copyright (c) 2019 Almer Mendoza Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!--froi/__init__.pyfrom .froi import Froi __version__ = '0.1.0' PK! froi/froi.pyimport json class AppNotDefined(Exception): """All routes will fail if app is not defined""" def __init__(self, message): self.message = message def __str__(self): return self.message class HttpMethodConflict(Exception): """Defined HTTP methods with defined function once""" def __init__(self, message): self.message = message def __str__(self): return self.message class Froi: """ Template for all routes to be created for APIs. A Flask wrapper that installs routes as defined from a class. It will accept :app: as paremeter that will be the server's context and will be used to set route. """ def __init__(self, app, component_name, prefix=''): self.component_name = component_name self.prefix = prefix if app.add_url_rule is None: raise AppNotDefined('Sent `app` is not valid') self.app = app self.method = None def route(self, url='', **kwargs): """Wrap server method's route""" add = self.app.add_url_rule add('{}{}'.format(self.prefix, url), methods=self.method, **kwargs) # handle forward slash if self.prefix is not '' or url is not '': add('{}{}/'.format(self.prefix, url), methods=self.method, **kwargs) self.method = None def _master_fxn(self, **kwargs): from flask import request return json.dumps({ 'message': '{} on {}'.format(request.method, self.component_name) }) def install(self): """Attach routes to defined app""" self.all().route(view_func=self._master_fxn) def _check_methods(self, method): if self.method is not None: self.method += [method] return self.method = [method] def all(self): self.get().post().put().delete() return self def get(self): self._check_methods('GET') return self def post(self): self._check_methods('POST') return self def put(self): self._check_methods('PUT') return self def delete(self): self._check_methods('DELETE') return self PK!_H88 froi-0.1.3.dist-info/LICENSE.txtThe MIT License (MIT) Copyright (c) 2019 Almer Mendoza Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HڽTUfroi-0.1.3.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!H^Q>froi-0.1.3.dist-info/METADATAUo0_qR N4ҭZK1&vf;I(u}w+<6BC69j%V~}6+MC8ϸEFdXqdZ $ p]) [qncl r|I o_R( . nJ'MI)dÒj*9 e~ZÜ,nsGK' b)(Fӫ*àt씊1"Hz! zvâz}Dy..\1'oxZw:i{MA[|=m,chW> 6p˘TC-p]>R!yqVZ,[ܥVMVJHݦ4cAJw/<=È+!!"/3򵵝z;TDFQ`vz1pǔFl ɤ m"_XÞħ,2YKM_n9I  UQZx`8Q Ý#:6dk?Qkî芩s%GRr7&9Α`l*n/^z3mT) 6ᘟdQȀ`oDAԎL2N&xx5xG: o:wKIo"uEšKKLGyZfPpK.݄ ޮ%1ra+4;Egg^n+Q^ZZ'Vbŧ|хzV=o܃@r4-9/[D>^Jv r}%ns#B|RJI ZKP_PK!H),froi-0.1.3.dist-info/RECORDMo0>KE0PK R^+ >%n<_eαb[$$+oT=EF'd!F R f3%+6TʌD&J,֐-froi-0.1.3.dist-info/METADATAPK!H),5froi-0.1.3.dist-info/RECORDPK