{"id":27258297,"url":"https://github.com/buanzo/pyflask-restful-assistant","last_synced_at":"2026-04-30T13:34:36.374Z","repository":{"id":74580389,"uuid":"108173420","full_name":"buanzo/pyflask-restful-assistant","owner":"buanzo","description":"pyflask-api-generator is a plugin-based tool that generates Python 3 source code for the main purpose of implement RESTful API server applications using the Flask-RESTful module. It is built using Python 3.5, Jinja2 templating library and other standard Python modules.","archived":false,"fork":false,"pushed_at":"2018-12-05T14:12:40.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T03:35:37.856Z","etag":null,"topics":["flask","flask-api","flask-restful","jinja2","python3","scaffolding-wizards"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buanzo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-10-24T19:26:41.000Z","updated_at":"2018-12-05T14:12:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"5ee25565-bd41-42a7-9324-d25be876ea9b","html_url":"https://github.com/buanzo/pyflask-restful-assistant","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/buanzo/pyflask-restful-assistant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buanzo%2Fpyflask-restful-assistant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buanzo%2Fpyflask-restful-assistant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buanzo%2Fpyflask-restful-assistant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buanzo%2Fpyflask-restful-assistant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buanzo","download_url":"https://codeload.github.com/buanzo/pyflask-restful-assistant/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buanzo%2Fpyflask-restful-assistant/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32466333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","flask-api","flask-restful","jinja2","python3","scaffolding-wizards"],"created_at":"2025-04-11T03:20:20.755Z","updated_at":"2026-04-30T13:34:36.362Z","avatar_url":"https://github.com/buanzo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pyflask-api-generator (also known as Fax - Flask API eXtrapolator)\n------------------------------------------------------------------\n\n# Introduction\n\npyflask-api-generator is a plugin-based scaffolding tool that generates Python 3 source code\nfor the main purpose of implement RESTful API server applications using the\nFlask-RESTful module. It is built using Python 3.5, Jinja2 templating library\nand other standard Python modules.\n\nThe alias name for this tool is 'fax' (Flask-Api-eXtrapolator, if I may).\n\n# Usage\n\nFax includes command line switches to specify a different configuration file,\nlisting included plugins and their description, show plugin config-file dependencies,\nand Dumping the configuration to screen. The --version argument also shows which\npaths will be read to find template files and plugins.\n\nOf course, because of Python's ConfigParser module, -h / --help is available:\n\n```\npyflask-api-generator $ ./fax -h\n\u003e\u003e\u003e pyflask-api-generator aka frasspy \u003c\u003c\u003c\nusage: fax [-h] [-c CONFIG] [--version] [-l] [-n] [-D]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -c CONFIG, --config CONFIG\n                        Config file path (/home/buanzo/buanzo/git/pyflask-\n                        restful-assistant/frasspy.conf)\n  --version             Show version and paths\n  -l, --list            List available plugins\n  -n, --needs           Run dependency check on plugins and report back\n  -D, --dump            Dumps configuration\n```\n\n## Listing Plugins\n\n```\npyflask-api-generator $ ./fax -l\n\u003e\u003e\u003e pyflask-api-generator aka fax \u003c\u003c\u003c\n+-------------------+--------------------------------------------------------+\n|    Plugin Name    |                      Description                       |\n+-------------------+--------------------------------------------------------+\n| EntryPoint*       | Creates primary Flask-RESTful entrypoint.              |\n| PEP8Check*        | Filter plugin that runs pep8 validation                |\n| RemoteSyslog      | Adds remote syslog support to your application         |\n| RotatingLog       | Adds rotated logging to your application               |\n| Package*          | Creates empty __init__.py inside package folder        |\n| Syslog            | Adds local syslog support to your application          |\n| DBTools           | Adds MySQL support to your application                 |\n| Services*         | Creates flask-restful code for each defined service    |\n| SamplePlugin      | Sample plugin. Read it if you want to code your own.   |\n+-------------------+--------------------------------------------------------+\nNote: A plugin marked with * runs by default.\n```\n\n## Version and Template/Plugin Paths\n\n```\npyflask-api-generator $ ./fax --version\n\u003e\u003e\u003e pyflask-api-generator aka fax \u003c\u003c\u003c\nversion: 0.1.0\nTemplates Path : /opt/pyflask-api-generator/Fax/plugins\nPlugins Path   : /opt/pyflask-api-generator/Fax/templates\n```\n\n## Plugin Dependencies\n\nWhen using the -n switch, only those plugins that would run (by default or by\nsetting features= on the config file) will output dependency data:\n\n\n```\npyflask-api-generator $ ./fax -n\n\u003e\u003e\u003e pyflask-api-generator aka fax \u003c\u003c\u003c\nEntryPoint needs basename in global\nEntryPoint needs privname in global\nEntryPoint needs backname in global\nEntryPoint needs author in global\nEntryPoint needs backname_services in global\nEntryPoint needs paths in service1\nEntryPoint needs paths in service2\nEntryPoint needs paths in anotherservice\nRemoteSyslog needs basename in global\nRemoteSyslog needs author in global\nPackage needs author in global\nPackage needs basename in global\nDBTools needs basename in global\nDBTools needs author in global\nDBTools needs user in dbtools\nDBTools needs pass in dbtools\nDBTools needs host in dbtools\nDBTools needs db in dbtools\nDBTools needs user in dbtools_readonly\nDBTools needs pass in dbtools_readonly\nDBTools needs host in dbtools_readonly\nDBTools needs db in dbtools_readonly\nServices needs author in global\nServices needs basename in global\nServices needs backname in global\nServices needs backname_services in global\n```\n\n# Configuration File\n\nFax reads a configuration file (by default, fax.conf in the current working directory).\nYou can specify a different configuration file by using the \"-c\" command-line switch.\n\nThis is how a Fax configuration file looks like:\n\n```\n[global]\nauthor = Sample Author \u003csampleauthor@company.mail\u003e\nbasename = app\nprivname = internal\nfeatures = remotesyslog, dbtools\nbackname = api\nbackname_services = users,config,help\n# MUST exist. FAX only creates inside it:\noutput_dir = /usr/local/src/my_api_server\n\n[users]\npaths = /service1/\u003csomeparam\u003e,/service1/\u003csomeparam\u003e/\u003csomeid\u003e\n\n[config]\npaths = /service2/\u003cid\u003e\n\n[help]\npaths = /icanusewhateveriwant/\u003cid\u003e,/evendifferent/structs/\u003cid\u003e\n\n[dbtools]\nuser = rwUser\npass = rwPassword\nhost = rwHostname\ndb = rwDatabase\n\n[dbtools_readonly]\nuser = roUser\npass = roPassword\nhost = roHostname\ndb = roDatabase\n\n[remotesyslog]\nurl=tcp://host:port\ninitmsg=\"My-Api-Server has started\"\n```\n\n## Configuration Dump\n\n```\npyflask-api-generator $ ./fax -D\n\u003e\u003e\u003e pyflask-api-generator aka fax \u003c\u003c\u003c\n{'anotherservice': {'paths': ['/icanusewhateveriwant/\u003cid\u003e',\n                              '/evendifferent/structs/\u003cid\u003e']},\n 'dbtools': {'db': 'rwDatabase',\n             'host': 'rwHostname',\n             'pass': 'rwPassword',\n             'user': 'rwUser'},\n 'dbtools_readonly': {'db': 'roDatabase',\n                      'host': 'roHostname',\n                      'pass': 'roPassword',\n                      'user': 'roUser'},\n 'global': {'author': 'Some Author \u003cSomeAuthoro@somecompany\u003e',\n            'backname': 'api',\n            'backname_services': ['service1', 'service2', 'anotherservice'],\n            'basename': 'example',\n            'features': ['dbtools', 'remotesyslog'],\n            'output_dir': '/tmp/api',\n            'privname': 'privname'},\n 'remotesyslog': {'initmsg': '\"test remote syslog message sent during syslog '\n                             'class __init__\"',\n                  'url': 'tcp://host:port'},\n 'rotatinglog': {'count': '10',\n                 'logdir': '/some/log/location',\n                 'maxsize': '1048576'},\n 'sections': ['global',\n              'service1',\n              'service2',\n              'anotherservice',\n              'dbtools',\n              'dbtools_readonly',\n              'syslog',\n              'remotesyslog',\n              'rotatinglog'],\n 'service1': {'paths': ['/service1/\u003csomeparam\u003e',\n                        '/service1/\u003csomeparam\u003e/\u003csomeid\u003e']},\n 'service2': {'paths': '/service2/\u003cid\u003e'},\n 'syslog': {'initmsg': '\"test syslog message sent on syslog class __init__\"'}}\n```\n\n# Structure of Plugins\n\n## Database support plugin\n\n```python\nfrom Fax.fax_plugin import FAXPlugin\nfrom Fax.plugin_api import PluginApi, FAXRender\n\nimport sys\n\n\nclass DBTools(FAXPlugin):\n    author = 'Arturo Busleiman \u003cbuanzo@buanzo.com.ar\u003e'\n    description = 'Adds MySQL support to your application'\n\n    def __init__(self):\n        self.name = self.__class__.__name__\n        self.api = PluginApi(callerName=self.name)\n        self.cfg = self.api.config()\n\n    def dependencyCheck(self):\n        # This hook checks if self.cfg holds whatever\n        # values we need. Config should have already been\n        # validated at a basic level at this point\n        # by FAXCore/FAXConfig.\n        #\n        # good place to create plugin-wide template vars\n        #\n        # TODO: error-control this for proper fax exit()\n        self.api.report_config_dependency('global', 'basename')\n        self.api.report_config_dependency(section='global',\n                                          option='author')\n        reqoptions = ('user', 'pass', 'host', 'db')\n        reqsections = ('dbtools', 'dbtools_readonly')\n        for section in reqsections:\n            for option in reqoptions:\n                self.api.report_config_dependency(section, option)\n\n    def setupVars(self):\n        \"\"\" This hook is run after dependencyCheck for the purposes\n        of setting up any variables that might be required for other\n        hooks, particularly by the render() hook.\n        \"\"\"\n        self.names = {}\n        self.templatevars = {}\n        self.names['basename'] = self.cfg['global']['basename']\n        self.dbtools = {}\n        self.dbtools['user'] = self.cfg['dbtools']['user']\n        self.dbtools['pass'] = self.cfg['dbtools']['pass']\n        self.dbtools['host'] = self.cfg['dbtools']['host']\n        self.dbtools['db'] = self.cfg['dbtools']['db']\n        self.dbtools_ro = {}\n        self.dbtools_ro['user'] = self.cfg['dbtools_readonly']['user']\n        self.dbtools_ro['pass'] = self.cfg['dbtools_readonly']['pass']\n        self.dbtools_ro['host'] = self.cfg['dbtools_readonly']['host']\n        self.dbtools_ro['db'] = self.cfg['dbtools_readonly']['db']\n        self.templatevars['names'] = self.names\n        self.templatevars['dbtools'] = self.dbtools\n        self.templatevars['dbtools_readonly'] = self.dbtools_ro\n        self.templatevars['author_name'] = self.cfg['global']['author']\n        return\n\n    def getImportLine(self):\n        # This function returns a string\n        # that represents the python code to import the\n        # generated module.\n        # e.g 'from blah_dbtools import BLAHDb'\n        # It is used by entrypoint plugin.\n        # TODO: actually implement all this\n        # example: from cuac_dbtools import CUACDb\n        l = self.names['basename'].lower()\n        u = l.upper()\n        rs = 'from {}.{}_dbtools import {}Db'.format(l, l, u)\n        self.api.report_import_line(rs)\n        return(rs)\n\n    def render(self):\n        # First, we create our own variables, adapted\n        # for template readability\n        lb = self.names['basename'].lower()\n        vars = self.templatevars\n        path = '{}/'.format(lb)\n        fn = '{}_dbtools.py'.format(lb)\n        output = self.api.render(template='dbtools.tpl',\n                                 variables=vars)\n        retObj = FAXRender(creator=self.name,\n                           relpath=path,\n                           filename=fn,\n                           contents=output)\n        self.api.report_render_object(retObj)\n        return(retObj)\n```\n\n## PEP8 compliance check plugin\n\n```python\n# PEP8Check plugin\nfrom Fax.fax_plugin import FAXPlugin\nfrom Fax.plugin_api import PluginApi, FAXRender\nimport pep8\n\nclass PEP8Check(FAXPlugin):\n    author = 'Arturo Busleiman \u003cbuanzo@buanzo.com.ar\u003e'\n    description = 'Filter plugin that runs pep8 validation'\n    default = True\n\n    def __init__(self):\n        self.name = self.__class__.__name__\n        self.api = PluginApi(callerName=self.name)\n\n    def afterWrite(self):\n        pep8style = pep8.StyleGuide(quiet=False)\n        objs = self.api.get_render_objects()\n        f2c = []\n        for obj in objs:\n            f2c.append(obj.fullpath)\n        result = pep8style.check_files(f2c)\n\n```\n\n\n# Useful Links\n\n* http://jinja.pocoo.org/docs/2.9/\n* http://jinja.pocoo.org/docs/2.9/templates/\n* ConfigParser https://docs.python.org/3.6/library/configparser.html\n* https://docs.python.org/3/library/tokenize.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuanzo%2Fpyflask-restful-assistant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuanzo%2Fpyflask-restful-assistant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuanzo%2Fpyflask-restful-assistant/lists"}