{ "info": { "author": "Drachenfels", "author_email": "drachu@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Version Control :: Git", "Topic :: Utilities" ], "description": "url2vapi (url to versioned api)\n-------------------------------\n\nIt's is tiny package that provides one function `split`. Function takes two\narguments: url and pattern, then attempts to parse the url according to the\npattern. Returning result is new object that contains all matched variables +\nreminding part of the url. Package for most part uses standard urllib.parse\nwith a bits added on top of it.\n\nExample usage:\n\n >>> import url2vapi\n\n >>> print(url2vapi.split('http://www.example.com/').as_dict())\n {'domain': 'www.example.com', 'port': None, 'protocol': 'http', 'remainder': ''}\n\n >>> print(url2vapi.split('http://www.example.com/dd/ff/').as_dict())\n {'domain': 'www.example.com', 'port': None, 'protocol': 'http', 'remainder': 'dd/ff/'}\n\n >>> print(url2vapi.split('http://www.example.com/3.0/dd/ff/').as_dict())\n {'domain': 'www.example.com', 'port': None, 'protocol': 'http', 'remainder': '3.0/dd/ff/'}\n\n >>> print(url2vapi.split('http://www.example.com/3.0/dd/ff/', pattern='').as_dict())\n {'domain': 'www.example.com', 'port': None, 'protocol': 'http', 'remainder': 'dd/ff/', 'version': {'prefix': '', 'suffix': '', 'value': 3}}\n\n >>> print(url2vapi.split('http://www.example.com/3.0/dd/ff/', pattern='').as_dict())\n {'domain': 'www.example.com', 'port': None, 'protocol': 'http', 'remainder': 'dd/ff/', 'version': {'prefix': '', 'suffix': '', 'value': 3.0}}\n\n >>> print(url2vapi.split('http://www.example.com/3.0/letters/c/', pattern='/').as_dict())\n {'port': None, 'namespace': {'prefix': '', 'suffix': '', 'value': 'letters'}, 'version': {'prefix': '', 'suffix': '', 'value': 3.0}, 'domain': 'www.example.com', 'protocol': 'http', 'remainder': 'c/'}\n\nor something more exotic:\n\n >>> print(url2vapi.split(\n 'http://www.example.com/v3_1.1_0.1-b1/3/a/',\n pattern='v-b1>/').as_dict())\n {'port': None, 'version': {'prefix': 'v', 'suffix': '-b1', 'value': (3.0, 1.1, 0.1)}, 'domain': 'www.example.com', 'protocol': 'http', 'remainder': 'a/', 'namespace_number': {'prefix': '', 'suffix': '', 'value': 3}}\n\nAvailable patterns\n\nPattern is a string that should contain groups, each group is defined as follows:\n\n (optional_prefix)(optional_suffix)\n\nWhere:\n\n - optional_prefix - is any alphanumeric range of characters, defaults to '' (with addition of some common characters like `_-\\.,`)\n - name_of_the_group - is mandatory alphanumeric range of one or more characters (underscores are available) \n - optional_type can be one of the following: `number`, `double`, `string`, `bool` or `tuple`, defaults to `string`\n - if type is set to `tuple`, we can specify delimiter (ie. characters `.,|_-`)\n - tuple can specify subtype in a form `tuple[double]` or `tuple[bool]` but not `tuple[tuple]`\n - optional_suffix - is any alphanumeric range of characters, defaults to '' (with addition of some common characters like `_-\\.,`)\n\nTesting\n\nGit clone repository, pip install dependency and then run nosetests by simply `./bin/run_tests.sh` (this will open browser with coverage result)\n\nOr\n\n`python setup.py test`\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Drachenfels/url2vapi", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "url2vapi", "package_url": "https://pypi.org/project/url2vapi/", "platform": "", "project_url": "https://pypi.org/project/url2vapi/", "project_urls": { "Homepage": "https://github.com/Drachenfels/url2vapi" }, "release_url": "https://pypi.org/project/url2vapi/1.2/", "requires_dist": null, "requires_python": "", "summary": "Tools extracts constant elements from url (for example version)", "version": "1.2" }, "last_serial": 3663119, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "35e10a2a9ac418f9cc26992c21371185", "sha256": "c99f297c409294938e895d7c7ef389e95419651260a92fe95bcf82941c124f1a" }, "downloads": -1, "filename": "url2vapi-1.0.tar.gz", "has_sig": false, "md5_digest": "35e10a2a9ac418f9cc26992c21371185", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4546, "upload_time": "2018-03-12T17:07:49", "url": "https://files.pythonhosted.org/packages/e8/17/dbe29f84c96939f844653a1e2a74a5a212984ae866639b9d945e85339ae1/url2vapi-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "a34721502c8c34dce3f424a3042e9668", "sha256": "fc93a90c85a691d2f6d6d44dae3d77c6e41698b680fafb32c5255dbbca4e3de7" }, "downloads": -1, "filename": "url2vapi-1.1.tar.gz", "has_sig": false, "md5_digest": "a34721502c8c34dce3f424a3042e9668", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4553, "upload_time": "2018-03-12T17:12:49", "url": "https://files.pythonhosted.org/packages/02/91/9293be5ba1644267eec22a85605070c75f4ef56c1c1e8bf91f7e2474819d/url2vapi-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "aa0392b23b7e513bd1603fc61cf28594", "sha256": "c19a06900182ee20e8a9a70fc70e0e4f545a446af38b1eb009792ef7ec0ef18b" }, "downloads": -1, "filename": "url2vapi-1.2.tar.gz", "has_sig": false, "md5_digest": "aa0392b23b7e513bd1603fc61cf28594", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4620, "upload_time": "2018-03-12T20:45:18", "url": "https://files.pythonhosted.org/packages/92/15/1f173db91d3dbe8e8558d4cba163c0da8d0ac5a241e6999df753e1450d6f/url2vapi-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "aa0392b23b7e513bd1603fc61cf28594", "sha256": "c19a06900182ee20e8a9a70fc70e0e4f545a446af38b1eb009792ef7ec0ef18b" }, "downloads": -1, "filename": "url2vapi-1.2.tar.gz", "has_sig": false, "md5_digest": "aa0392b23b7e513bd1603fc61cf28594", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4620, "upload_time": "2018-03-12T20:45:18", "url": "https://files.pythonhosted.org/packages/92/15/1f173db91d3dbe8e8558d4cba163c0da8d0ac5a241e6999df753e1450d6f/url2vapi-1.2.tar.gz" } ] }