{ "info": { "author": "Mohammad Alghafli", "author_email": "thebsom@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Programming Language :: Python :: 3.5" ], "description": ":Date: 2019-01-30\n:Version: 0.0.3\n:Authors:\n * Mohammad Alghafli \n\ncofan is an http server library for serving files and any other things. You use\nit to share content in the form of a website. The current classes give you the\nfollowing:\n \n * Serve the content of a local directory in a form similar to file browser\n with icons for directories and files based on their extension.\n * Serve the content of a local zip file the same way as the local\n directories.\n * List the content of a local directory in json form.\n * Serve local html files as a web site.\n * Organize your urls in prefix trees.\n * Response differently for different ip addresses\n\nIt also supports requests of partial files to resume previously interrupted\ndownload.\n\nHere is an example of how to use it::\n \n from cofan import *\n import pathlib\n \n #our site will be like this:\n # / (this is our root. will list all the branches below)\n # |\n # |- vid/\n # | this branch is a file browser for videos\n # |\n # -- site/\n # this will be a web site. just a collection of html files\n \n #lets make an http file browser and share our videos\n #first, we specify the icons used in the file browser\n #you can omit the theme. it defaults to `humanity`\n icons = Iconer(theme='humanity')\n \n #now we create a Filer and specify the path we want to serve\n vid = Filer(pathlib.Path.home() / 'Videos', iconer=icons)\n \n #we also want to serve a web site. lets create another filer. since the root\n #directory of the site contains `index.html` file, the filer\n #will automatically redirect to it instead of showing a file browser\n #no file browser also means we do not need to specify `iconer`\n #parameter. you can still use it if you want but that would not be very\n #useful\n site = Filer(pathlib.Path.home() / 'mysite')\n \n #now we need to give prefixes to our branches\n #we create a patterner\n patterns = Patterner()\n \n #then we add the iconer, filers with their prefixes\n #make sure to add a trailing slash\n patterns.add('vid/', vid)\n patterns.add('site/', site)\n #we also need to add our iconer\n #you need to tell the iconer about its prefix. by default it assumes\n #`__icons__`\n patterns.add('__icons__/', icons)\n \n #now we have all branches. but what if the user types our root url?\n #the path we will get will be an empty string which is not a prefix of any\n #branch. that will be a 404\n #lets make the root list and other branches added to `patterns`\n #the branches will be shown like the file browser but now the icons will be\n #for the patterns instead of file extensions\n #we need to specify where the icons are taken from\n #the icons file should contain an icon named `vid.` and an icon named\n #`site.` where can be any extension.\n root = PatternLister(patterns, root=pathlib.Path.home() / 'icons.zip')\n \n #and we add our root to the patterns with empty prefix\n patterns.add('', root)\n \n #now we create our handler like in http.server. we give it our patterner\n handler = BaseHandler(patterns)\n \n #and create our server like in http.server\n srv = Server(('localhost', 8000), handler)\n \n #and serve forever\n srv.serve_forever()\n \n #now try to open your browser on http://localhost:8000/\n\nThis module can also be run as a main python script to serve files from a\ndirectory.\n\ncommandline syntax::\n\n python -m cofan.py [-a ] []\n\noptions:\n\n * -a , --addr : specify the address and port to bind to. \n should be in the form `:` where `` is the ip address and\n `` is the tcp port. defaults to `localhost:8000`.\n\nargs:\n\n * root: The root directory to serve. Defaults to the current directory.\n\n--------\nTutorial\n--------\nCheck out cofan tutorial at http://cofan.readthedocs.io/", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/alghafli/cofan", "keywords": "http file server", "license": "", "maintainer": "", "maintainer_email": "", "name": "cofan", "package_url": "https://pypi.org/project/cofan/", "platform": "", "project_url": "https://pypi.org/project/cofan/", "project_urls": { "Homepage": "https://github.com/alghafli/cofan" }, "release_url": "https://pypi.org/project/cofan/0.0.3/", "requires_dist": null, "requires_python": "", "summary": "http server to serve files and other things.", "version": "0.0.3" }, "last_serial": 4761538, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "f2145da3fd76d92fe64a8e083be46024", "sha256": "f858a35d7847b99ea3a95e2ee144ecbbb40718f4f108bc55184101f7aefa3caa" }, "downloads": -1, "filename": "cofan-0.0.2.tar.gz", "has_sig": false, "md5_digest": "f2145da3fd76d92fe64a8e083be46024", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 578945, "upload_time": "2018-10-16T17:08:34", "url": "https://files.pythonhosted.org/packages/ef/38/0184755fc3c01ade5bb17b7328469ef5e8995e582100d7415a45135ef18b/cofan-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "1787d719621620d97d3357a403e0409e", "sha256": "489406b4d21e3b910807995ddf55e658fadaaa71564d371ae19f00d0bc0385fe" }, "downloads": -1, "filename": "cofan-0.0.3.tar.gz", "has_sig": false, "md5_digest": "1787d719621620d97d3357a403e0409e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 579322, "upload_time": "2019-01-30T21:48:42", "url": "https://files.pythonhosted.org/packages/0f/85/9284e1ec9e9204c7aeac7b079b7281b5c9d0190774c868d1665758469206/cofan-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1787d719621620d97d3357a403e0409e", "sha256": "489406b4d21e3b910807995ddf55e658fadaaa71564d371ae19f00d0bc0385fe" }, "downloads": -1, "filename": "cofan-0.0.3.tar.gz", "has_sig": false, "md5_digest": "1787d719621620d97d3357a403e0409e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 579322, "upload_time": "2019-01-30T21:48:42", "url": "https://files.pythonhosted.org/packages/0f/85/9284e1ec9e9204c7aeac7b079b7281b5c9d0190774c868d1665758469206/cofan-0.0.3.tar.gz" } ] }