{ "info": { "author": "Antonio Su\u00e1rez Jim\u00e9nez", "author_email": "pherkad13@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Programming Language :: Python :: 3", "Topic :: Utilities" ], "description": "Pysaurio\n========\n\nThis package contains two tools: Raptor & Reptar\n\nRaptor\n------\n\n**Raptor** for extracting and displaying information from a set of files of the same type; and creating a single file with all the selected information.\n\nThe information in the files may be in multiple rows::\n\n PC01.txt:\n User=ms123\n Name=Mayra Sanz\n OS=GNU/Linux\n IP=10.226.140.1\n\nBut, also, the information may be in several columns. It is possible to read data from multiple fields in a single line::\n\n PC01.log:\n User: ms123 Name: Mayra Sanz\n OS: GNU/Linux IP: 10.226.140.1 \n\n**Example:** data from the following files::\n\n PC01.txt:\n User=ms123\n Name=Mayra Sanz\n OS=GNU/Linux\n IP=10.226.140.1\n\n PC02.txt:\n User=lt001\n Name=Luis Toribio\n OS=GNU/Linux\n IP=10.226.140.2\n\n PC03.txt:\n User=co205\n Name=Clara Osto\n OS=Win\n IP=10.226.140.3\n\n... You can create a CSV file with the following information::\n\n users.csv:\n User,Name,OS,IP\n MS123,Mayra Sanz,GNU/linux,10.226.140.1\n LT001,Luis Toribio,GNU/linux,10.226.140.2\n CO205,Clara Osto,Win,10.226.140.3\n\nTo achieve this you need to create a template (.rap) with Raptor, which is similar to an INI file with the following information::\n\n users.rap:\n [General]\n description = Get list of users\n extension = txt\n prefix = PC\n output_folder = txt\n input_folder = txt\n output_file = users.csv\n delimiter = ,\n quotechar = \"\n include_header = 1\n include_file = 0\n include_record_num = 0\n include_empty_record = 0 \n search_multiple = 0\n alternate_header =\n search_multiple = 0\n\n [Fields]\n user = User=\n name = Name=\n os = OS=\n ip = IP=\n\n [Rules]\n rule1 = ('user', 'UPPER') \n\nTo create .rap template (If the .rap template exists it is not saved). (Caution: field names must be lowercase)::\n\n from pysaurio import Raptor \n rap1 = Raptor() \n rap1.description = 'Get list of users'\n rap1.extension = 'txt'\n rap1.prefix = 'PC'\n rap1.input_folder = 'txt'\n rap1.output_folder = 'txt'\n rap1.output_file = 'users.csv'\n rap1.delimiter = ','\n rap1.quotechar = '\"'\n rap1.include_header = '1'\n rap1.include_file = '1'\n rap1.include_record_num = '1'\n rap1.include_empty_record = '0'\n rap1.search_multiple = '0'\n rap1.alternate_header = ''\n rap1.fields['user'] = 'User='\n rap1.fields['name'] = 'Name='\n rap1.fields['os'] = 'OS='\n rap1.fields['ip'] = 'IP='\n rap1.rules.append(('user', 'UPPER'))\n rap1.rules.append(('name', 'REMOVEFROM', ' ')) \n rap1.Save(\"users.rap\") \n del rap1\n\n\n**Attribute List:**\n\n- description: short descripton of .rap template\n- extension: extension of the files to read\n- prefix: files must begin with this string\n- input_folder: folder of files to read\n- output_folder: output folder to save file with result\n- output_file: output filename\n- delimiter: delimiter character\n- quotechar: quote character\n- include_header: '0' or '1'\n- include_file: '0' or '1'\n- inclide_file_datetime: '0' or '1' (file creation & modification date/time)\n- include_record_num: '0' or '1'\n- include_empty_record: '0' or '1'\n- search_multiple: '0' or '1'\n- alternate_header: alternative text of the report header\n- fields: dictionary with fieldnames and search string (read template)\n- record: dictionary with fieldnames and values (read template)\n- rules: list of rules (read template)\n- list_files: list of filenames to read (auto)\n- record_counter: number of records (auto) \n- errors: list of errors (auto)\n- number_errors: number of errors after you open or save a template \n\n**Functions available for rules:**\n\n- rule1 = (fieldname, 'SUBSTR', postion_initial, lenght)\n- rule1 = (fieldname, 'REPLACE', 'search_string', 'replace_string')\n- rule1 = (fieldname, 'REPLACEALL', 'search_string', 'replace_string')\n- rule1 = (fieldname, 'UPPER')\n- rule1 = (fieldname, 'LOWER')\n- rule1 = (fieldname, 'REVERSE')\n- rule1 = (fieldname, 'REMOVE')\n- rule1 = (fieldname, 'FIELDISDATA')\n- rule1 = (fieldname, 'REMOVEFROM', 'string')\n- rule1 = (fieldname, 'REMOVETO', 'string')\n\nOpens template (.rap) and creates (.csv) file from the data read from multiple text files::\n\n from pysaurio import Raptor\n import csv\n\n rap2 = Raptor()\n rap2.Open('users.rap')\n if rap2.number_errors == 0: \n file_csv = open(rap2.output_file, 'w', newline='')\n csv_output = csv.writer(file_csv, \n delimiter=rap2.delimiter,\n quotechar=rap2.quotechar, \n quoting=csv.QUOTE_MINIMAL)\n if rap2.include_header == '1':\n fields_list = rap2.BuildHeader()\n print(fields_list)\n csv_output.writerow(fields_list)\n\n for row in rap2.list_files:\n valid_record, new_record = rap2.BuildRow(row)\n new_record = rap2.ApplyRules(new_record)\n if valid_record:\n new_record = list(new_record.values())\n print(new_record)\n csv_output.writerow(new_record) \n file_csv.close() \n else:\n print(rap2.ShowError())\n del rap2\n\n\nReptar\n------\n\n**Reptar** allows merge files, including only the necessary lines.\n\n**Example:** data from the following files::\n\n PCS01.txt:\n User,Name,OS,IP\n ms123,Mayra Sanz,GNU/Linux,10.226.140.1\n lt001,Luis Toribio,GNU/Linux,10.226.140.2\n co205,Clara Osto,Win,10.226.140.3\n\n PCS02.txt:\n User,Name,OS,IP\n nn345,Nadia Pacheco,Win,10.226.140.4\n jm401,Juan Madrid,GNU/Linux,10.226.140.5\n\n... You can create a file with the following information::\n\n Linux.csv:\n User,Name,OS,IP\n MS124,MAYRA SANZ,GNU/LINUX,10.226.140.1\n LT001,LUIS TORIBIO,GNU/LINUX,10.226.140.2\n CO205,CLARA OSTO,WIN,10.226.140.3\n JM401,JUAN MADRID,GNU/LINUX,10.226.140.5\n\nIn this example, lines that contain the text \"Linux\" or beginning with the text \"co205\" are included::\n\n from pysaurio import Reptar\n rep1 = Reptar() \n rep1.description = 'Get list of Linux users'\n rep1.extension = 'txt'\n rep1.prefix = 'PCS'\n rep1.input_folder = 'txt'\n rep1.output_folder = 'txt'\n rep1.output_file = 'Linux.csv'\n rep1.include_header = '1'\n rep1.include_file = '0'\n rep1.include_record_num = '0'\n rep1.alternate_header = ''\n rep1.lines.append(('INCLUDE', 'Linux'))\n rep1.lines.append(('INCLUDRE', '^co205'))\n rep1.rules.append(('line', 'UPPER')) \n rep1.Save(\"linux.rep\")\n del rep1\n\n # Opens .rep template and create file with output information\n\n rep2 = Reptar()\n rep2.Open('linux.rep')\n if rep2.number_errors == 0: \n file_csv = open(rep2.output_file, 'w')\n if rep2.include_header == '1':\n header = rep2.BuildHeader(rep2.list_files[0])\n print(header)\n file_csv.write(header + '\\n')\n\n for row in rep2.list_files:\n current_file = open(rep2.input_folder + row, 'rb')\n while True:\n new_record = current_file.readline()\n new_record = new_record.decode(\"utf-8\", \"ignore\")\n if not new_record: break\n valid_record, new_record = rep2.BuildRow(new_record, row)\n if valid_record:\n new_record = rep2.ApplyRules(new_record)\n print(new_record)\n file_csv.write(new_record + '\\n')\n current_file.close()\n file_csv.close() \n else:\n print(rep2.ShowError())\n del rep2\n\n\n**Functions available for including and excluding lines:**\n\n- line1 = ('EXCLUDE', 'string')\n- line1 = ('INCLUDE', 'string')\n- line1 = ('EXCLUDEND', 'string')\n- line1 = ('INCLUDEND', 'string')\n- line1 = ('EXCLUDRE', 'regex', '0'|'1') # '1' not case sensitive\n- line1 = ('INCLUDRE', 'regex', '0'|'1') # (See module re)\n\nThe package contains more examples and data files to test.\n\nChangelog\n---------\n\n- Pysaurio 0.2.6 - 2018-09-14 - Corrected error in function REMOVECOL\n- Pysaurio 0.2.5 - 2016-09-09 - new attribute: include_file_datetime = '0' or '1'\n- Pysaurio 0.2.4 - Reptar include new rule: 'REMOVECOL', remove column\n- Pysaurio 0.2.3 - New functions: 'INCLUDEND' and 'EXCLUDEND'\n- Pysaurio 0.2.2 - New argument in the 'INCLUDRE' and 'EXCLUDRE' functions\n- Pysaurio 0.2.1 - Reptar includes rules and the section 'Lines' you can use regular expressions.\n- Pysaurio 0.2.0 - Initial release (continued \"Pyraptor\").\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://pypi.python.org/pypi/pysaurio", "keywords": "pysaurio search extract text csv collect data merge join pyraptor", "license": "GNU GPLv3", "maintainer": "", "maintainer_email": "", "name": "pysaurio", "package_url": "https://pypi.org/project/pysaurio/", "platform": "", "project_url": "https://pypi.org/project/pysaurio/", "project_urls": { "Homepage": "https://pypi.python.org/pypi/pysaurio" }, "release_url": "https://pypi.org/project/pysaurio/0.2.6/", "requires_dist": null, "requires_python": "", "summary": "A tool for searching & extracting information from multiple text files.", "version": "0.2.6" }, "last_serial": 4273112, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "6e15922b08d70363808ac4354e841def", "sha256": "ca57ed53a5224a7651a91a4b1a53a879dcf6144149a64587ebed63292f575d5f" }, "downloads": -1, "filename": "pysaurio-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6e15922b08d70363808ac4354e841def", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11071, "upload_time": "2016-04-16T13:27:29", "url": "https://files.pythonhosted.org/packages/7a/f8/3cfe2be54c08977e7c9a75e4b26c6e45ed068e5d0774e0b194bce903c27e/pysaurio-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "31fa240109e03f5c5d8f51a48ac77217", "sha256": "9587c15663e6f51ce4487210f2fc04f0cbcbc7a5577c831910d83eb88e553d8e" }, "downloads": -1, "filename": "pysaurio-0.2.0.tar.gz", "has_sig": false, "md5_digest": "31fa240109e03f5c5d8f51a48ac77217", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26890, "upload_time": "2016-04-16T13:31:55", "url": "https://files.pythonhosted.org/packages/35/5d/865554f55ea831f2cde5631342e39439f6ad2aaf6da4c9cf63e2e470bd9c/pysaurio-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "a9d8ab0b8b847ab0d5d3caa35859401e", "sha256": "e117a14c1896b2e63b9bc63469c0abd0015c3d128a95b04a801501db3f382d38" }, "downloads": -1, "filename": "pysaurio-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "a9d8ab0b8b847ab0d5d3caa35859401e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11815, "upload_time": "2016-04-18T22:45:02", "url": "https://files.pythonhosted.org/packages/4e/df/ab67a4eeddb87dc45c4e137bed07a36a9341809e6e265bdb12ba1147fd03/pysaurio-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f8b0a3beafa83fb5439d1c5e162966d5", "sha256": "f9378009a1ac21a1c65629e40bc8d4ab0a1fb24e9335f4fee88c0807314b6f86" }, "downloads": -1, "filename": "pysaurio-0.2.1.tar.gz", "has_sig": false, "md5_digest": "f8b0a3beafa83fb5439d1c5e162966d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27968, "upload_time": "2016-04-18T22:45:21", "url": "https://files.pythonhosted.org/packages/ff/76/67cdc3eb48bfd2c24bdfc176b733a1565b558cffe5cd2ad13fff0ea79b05/pysaurio-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "28d94aea2b9c4039ddfe162e2d2cdd73", "sha256": "1134799e475964a579fb1cfb57153f12be26f750e062b679e29519cd22bea777" }, "downloads": -1, "filename": "pysaurio-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "28d94aea2b9c4039ddfe162e2d2cdd73", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11958, "upload_time": "2016-04-19T21:02:14", "url": "https://files.pythonhosted.org/packages/c8/31/4325f97323896bfa80dbec80b51b510b84ab35e3094b5a8c7339eb919c82/pysaurio-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f4ac2595140e4b7957a2923dda150217", "sha256": "a1d974a839080142ba7619e5b5c4069f59de202e06fd4c87a70343b5ce90aaec" }, "downloads": -1, "filename": "pysaurio-0.2.2.tar.gz", "has_sig": false, "md5_digest": "f4ac2595140e4b7957a2923dda150217", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27786, "upload_time": "2016-04-19T21:05:44", "url": "https://files.pythonhosted.org/packages/b5/5b/8bdb16cc932545d7a88f1bd56d19c18a98fe902215f4abc05f9013a9b4a1/pysaurio-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "54552afc11db36e6be4d8f5553753c50", "sha256": "18c7dbe8930612f058624d5ed7e58e8240f5fbd520b716b77efb8f0d7ad068cc" }, "downloads": -1, "filename": "pysaurio-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "54552afc11db36e6be4d8f5553753c50", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12101, "upload_time": "2016-04-22T18:07:02", "url": "https://files.pythonhosted.org/packages/b4/ae/3d4d0d88bc1526b127032e987a33a4f49634f87093da98f747846c92733b/pysaurio-0.2.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "51b053421f1204b81f7c577ed442e357", "sha256": "bfb403227a2b649347f5dc5408f0fd8f6686787a88426aa8b9ceaf4ec3af3b86" }, "downloads": -1, "filename": "pysaurio-0.2.3.tar.gz", "has_sig": false, "md5_digest": "51b053421f1204b81f7c577ed442e357", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28172, "upload_time": "2016-04-22T18:07:27", "url": "https://files.pythonhosted.org/packages/31/c2/34bb51eb1ebf3ff2e96726aa00a92ae5554358d73efbff1c6c1ca2e21f92/pysaurio-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "febe2a95b4d1f2a752d9b0ec8b683104", "sha256": "6e1bdff00024bd83873d8b7ad241d7e2d71d371457b031a21244c6d7d9f9691b" }, "downloads": -1, "filename": "pysaurio-0.2.4-py3-none-any.whl", "has_sig": false, "md5_digest": "febe2a95b4d1f2a752d9b0ec8b683104", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12441, "upload_time": "2016-05-08T21:31:17", "url": "https://files.pythonhosted.org/packages/49/b1/96432951d33e07dc1a925dbcee7ca106997ac5ab5a65f08f436b57e84ed1/pysaurio-0.2.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "736b5e7c3b562f40f9069df4605564a3", "sha256": "53ff9e59e3c2b721577dfcf8ad5a5bc4a65f509073860eb36383ed1f1eff8c1b" }, "downloads": -1, "filename": "pysaurio-0.2.4.tar.gz", "has_sig": false, "md5_digest": "736b5e7c3b562f40f9069df4605564a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28574, "upload_time": "2016-05-08T21:31:30", "url": "https://files.pythonhosted.org/packages/8b/c7/dfa14db29ea8121440e3f7ffe36b51a4ebc1ea4f627d61829bde2e0d5210/pysaurio-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "448e306e80beb49b3450c585c9379f09", "sha256": "a5768fa5bbf3fa0ba6a7b8503aa54ec2d9e43539ce2259b735bca24ea107c425" }, "downloads": -1, "filename": "pysaurio-0.2.5-py3-none-any.whl", "has_sig": false, "md5_digest": "448e306e80beb49b3450c585c9379f09", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12896, "upload_time": "2016-09-09T15:45:34", "url": "https://files.pythonhosted.org/packages/3b/d1/f604f85e165458d47a80aeb5f1d7e32d4accc325c725d4a707523c6af2d8/pysaurio-0.2.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "70ad3bb7bc3dbf22a392707e57dae2d5", "sha256": "b890642503c03018c64076ba97c9df713923672a92ee2ffbebb28842a10c8ac4" }, "downloads": -1, "filename": "pysaurio-0.2.5.tar.gz", "has_sig": false, "md5_digest": "70ad3bb7bc3dbf22a392707e57dae2d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29359, "upload_time": "2016-09-09T15:45:37", "url": "https://files.pythonhosted.org/packages/58/1d/c488ec491837fef3eb1a60d3000d558aa12f0993df50639991a884623afe/pysaurio-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "1be7fb257936a7f898fa2d91f8450b3b", "sha256": "a5219f5a7a92ed345bd3d7bd479cc54326ec06f4e0bbba5bf3f0cefe32d9e855" }, "downloads": -1, "filename": "pysaurio-0.2.6-py3-none-any.whl", "has_sig": false, "md5_digest": "1be7fb257936a7f898fa2d91f8450b3b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9307, "upload_time": "2018-09-14T17:22:15", "url": "https://files.pythonhosted.org/packages/a4/d4/19d7ac8d04065d7ecaac48b772fbad67aab530fff01579a64790ba837518/pysaurio-0.2.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2087b22f2d566e6dc11a8a610a6a6d8f", "sha256": "ecfe8aa1893c2fc7b825f3c42086c6be4171894ad4a3be4ea7b90ad65a3f6b5c" }, "downloads": -1, "filename": "pysaurio-0.2.6.tar.gz", "has_sig": false, "md5_digest": "2087b22f2d566e6dc11a8a610a6a6d8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31570, "upload_time": "2018-09-14T17:22:17", "url": "https://files.pythonhosted.org/packages/df/be/981b14cc4d2d6d60f714d2516218714a70c460bcb9a7ae383612bd1f4849/pysaurio-0.2.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1be7fb257936a7f898fa2d91f8450b3b", "sha256": "a5219f5a7a92ed345bd3d7bd479cc54326ec06f4e0bbba5bf3f0cefe32d9e855" }, "downloads": -1, "filename": "pysaurio-0.2.6-py3-none-any.whl", "has_sig": false, "md5_digest": "1be7fb257936a7f898fa2d91f8450b3b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9307, "upload_time": "2018-09-14T17:22:15", "url": "https://files.pythonhosted.org/packages/a4/d4/19d7ac8d04065d7ecaac48b772fbad67aab530fff01579a64790ba837518/pysaurio-0.2.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2087b22f2d566e6dc11a8a610a6a6d8f", "sha256": "ecfe8aa1893c2fc7b825f3c42086c6be4171894ad4a3be4ea7b90ad65a3f6b5c" }, "downloads": -1, "filename": "pysaurio-0.2.6.tar.gz", "has_sig": false, "md5_digest": "2087b22f2d566e6dc11a8a610a6a6d8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31570, "upload_time": "2018-09-14T17:22:17", "url": "https://files.pythonhosted.org/packages/df/be/981b14cc4d2d6d60f714d2516218714a70c460bcb9a7ae383612bd1f4849/pysaurio-0.2.6.tar.gz" } ] }