{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: PyPy" ], "description": ".. -*- mode: rst -*-\n\nrequests-fortified\n------------------------\n\n**Work In Progress**\n\nExtension of Python HTTP `requests `_ with verbose\nlogging using `logging-fortified `_, and robust handling for\nDownloading files containing JSON, CSV, and XML data formats and Streaming.\n\nImportant Note\n^^^^^^^^^^^^^^\n\nThis Python project is a refactoring of `requests-mv-integration `_\nfor the purpose of general usage intent.\n\nWork In Progress\n^^^^^^^^^^^^^^^^\n\nThe following still needs to be performed for this Python project:\n\n- Unit-testing: This project will be switching over to using Python native Unit testing framework `unittest `_.\n- More concise documentation is required.\n- Travis CI\n- Badges\n\n\nBadges\n------\n\n.. start-badges\n\n.. list-table::\n :stub-columns: 1\n\n * - info\n - |license|\n * - package\n - |version| |supported-versions|\n\n\n.. |license| image:: https://img.shields.io/badge/License-MIT-yellow.svg\n :alt: License Status\n :target: https://opensource.org/licenses/MIT\n\n.. |version| image:: https://img.shields.io/pypi/v/requests_fortified.svg?style=flat\n :alt: PyPI Package latest release\n :target: https://pypi.python.org/pypi/requests_fortified\n\n.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/requests-fortified.svg?style=flat\n :alt: Supported versions\n :target: https://pypi.python.org/pypi/requests-fortified\n\n.. end-badges\n\n\nInstall\n-------\n\n.. code-block:: bash\n\n pip install requests_fortified\n\n\nArchitecture\n------------\n\n``requests-fortified`` is an extension of the `Python package requests `_\nand it is used for handling all HTTP requests including APIs in REST and SOAP,\nscreen scrapping, and handling response downloads in JSON, XML, and CSV.\n\nUsage\n-----\n\n.. code-block:: python\n\n URL_REST_COUNTRIES = \\\n 'https://restcountries.eu/rest/v2/all'\n\n from requests_fortified import (\n RequestsFortifiedDownload,\n )\n request_download = RequestsFortifiedDownload(logger_level=logging.DEBUG)\n\n result = \\\n request_download.request(\n request_method='GET',\n request_url=URL_REST_COUNTRIES,\n request_params=None,\n request_retry=None,\n request_headers=HEADER_CONTENT_TYPE_APP_JSON,\n request_label=\"REST Countries\"\n )\n\n json_rest_countries = result.json()\n\n pprint(json_rest_countries)\n\n\nExample\n^^^^^^^\n\n.. code-block:: bash\n\n $ python3 examples/example_request.py\n\n ======================================================\n run-examples requests-fortified\n ======================================================\n rm -fR _tmp/*.json\n ======================================================\n 'Logger file path: ./tmp/log_1526043820.json'\n [\n '{\"asctime\": \"2018-05-11 06:03:26 -0700\", \"levelname\": \"NOTE\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"debug\"}\\n',\n '{\"asctime\": \"2018-05-11 06:03:26 -0700\", \"levelname\": \"INFO\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"START\"}\\n',\n '{\"asctime\": \"2018-05-11 06:03:26 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Start\"}\\n',\n '{\"asctime\": \"2018-05-11 06:03:26 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Start: Details\", \"Disk:\": {\"path\": \"/\", \"total\": \"232.62 GB\", \"used\": \"134.44 GB\", \"free\": \"97.94 GB\", \"percent\": 57}, \"Mem\": {\"total\": \"16.00 GB\", \"used\": \"12.50 GB\", \"free\": \"147.59 KB\", \"shared\": \"0 B\", \"buffers\": \"0 B\", \"cached\": \"0 B\"}, \"allow_redirects\": true, \"build_request_curl\": true, \"cookie_payload\": null, \"request_auth\": null, \"request_cert\": null, \"request_data\": null, \"request_headers\": {\"Content-Type\": \"application/json\", \"User-Agent\": \"(requests-fortified/0.1.0, Python/3.6.5)\"}, \"request_json\": null, \"request_label\": \"REST Countries\", \"request_method\": \"GET\", \"request_params\": null, \"request_retry\": {\"timeout\": 60, \"tries\": 3, \"delay\": 10}, \"request_url\": \"https://restcountries.eu/rest/v2/all\", \"stream\": false, \"timeout\": null, \"verify\": true}\\n',\n '{\"asctime\": \"2018-05-11 06:03:26 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Start\", \"request_label\": \"REST Countries\", \"request_retry_excps\": [\"ConnectTimeout\", \"ReadTimeout\", \"Timeout\"], \"request_retry_http_status_codes\": [500, 502, 503, 504, 429], \"timeout\": null}\\n',\n '{\"asctime\": \"2018-05-11 06:03:26 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Attempt\", \"attempts\": 1, \"delay\": 10, \"request_label\": \"REST Countries\", \"request_url\": \"https://restcountries.eu/rest/v2/all\", \"timeout\": 60, \"tries\": 3}\\n',\n '{\"asctime\": \"2018-05-11 06:03:26 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Session: Details\", \"cookie_payload\": {}, \"request_label\": \"REST Countries\"}\\n',\n '{\"asctime\": \"2018-05-11 06:03:26 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Details\", \"request_data\": \"\", \"request_headers\": {\"Content-Type\": \"application/json\", \"User-Agent\": \"(requests-fortified/0.1.0, Python/3.6.5)\"}, \"request_label\": \"REST Countries\", \"request_method\": \"GET\", \"request_params\": {}, \"request_url\": \"https://restcountries.eu/rest/v2/all\", \"timeout\": 60}\\n',\n '{\"asctime\": \"2018-05-11 06:03:26 -0700\", \"levelname\": \"NOTE\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Curl\", \"request_curl\": \"curl --verbose -X GET -H \\'Content-Type: application/json\\' -H \\'User-Agent: (requests-fortified/0.1.0, Python/3.6.5)\\' --connect-timeout 60 -L \\'https://restcountries.eu/rest/v2/all\\'\", \"request_label\": \"REST Countries\", \"request_method\": \"GET\"}\\n',\n '{\"asctime\": \"2018-05-11 06:03:26 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified.support.requests_session_client\", \"version\": \"0.1.0\", \"message\": \"Session Request: Details\", \"allow_redirects\": true, \"headers\": {\"Content-Type\": \"application/json\", \"User-Agent\": \"(requests-fortified/0.1.0, Python/3.6.5)\"}, \"method\": \"GET\", \"timeout\": 60, \"url\": \"https://restcountries.eu/rest/v2/all\", \"verify\": true}\\n',\n '{\"asctime\": \"2018-05-11 06:03:27 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Response: Details\", \"http_status_code\": 200, \"http_status_desc\": \"Request fulfilled, document follows\", \"http_status_type\": \"Successful\", \"response_headers\": {\"Date\": \"Fri, 11 May 2018 13:03:27 GMT\", \"Content-Type\": \"application/json;charset=utf-8\", \"Transfer-Encoding\": \"chunked\", \"Connection\": \"keep-alive\", \"Set-Cookie\": \"__cfduid=d46030914d4b01044c167b67bbca43b951526043807; expires=Sat, 11-May-19 13:03:27 GMT; path=/; domain=.restcountries.eu; HttpOnly\", \"Access-Control-Allow-Origin\": \"*\", \"Access-Control-Allow-Methods\": \"GET\", \"Access-Control-Allow-Headers\": \"Accept, X-Requested-With\", \"Cache-Control\": \"public, max-age=86400\", \"Expect-CT\": \"max-age=604800, report-uri=\\\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\\\"\", \"Server\": \"cloudflare\", \"CF-RAY\": \"4194d881fc146bd4-SJC\", \"Content-Encoding\": \"gzip\"}}\\n',\n '{\"asctime\": \"2018-05-11 06:03:27 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Cookie Payload\", \"cookie_payload\": {\"__cfduid\": \"d46030914d4b01044c167b67bbca43b951526043807\"}, \"request_label\": \"REST Countries\"}\\n',\n '{\"asctime\": \"2018-05-11 06:03:27 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Try Send Request: Is Return Response: Checking\", \"request_url\": \"https://restcountries.eu/rest/v2/all\"}\\n',\n '{\"asctime\": \"2018-05-11 06:03:27 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Try Send Request: Is Return Response: Valid\", \"request_url\": \"https://restcountries.eu/rest/v2/all\"}\\n',\n '{\"asctime\": \"2018-05-11 06:03:27 -0700\", \"levelname\": \"INFO\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Finished\", \"request_time_msecs\": 569}\\n',\n '{\"asctime\": \"2018-05-11 06:03:27 -0700\", \"levelname\": \"DEBUG\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"REST Countries: Usage\", \"Disk:\": {\"path\": \"/\", \"total\": \"232.62 GB\", \"used\": \"134.44 GB\", \"free\": \"97.94 GB\", \"percent\": 57}, \"Mem\": {\"total\": \"16.00 GB\", \"used\": \"12.50 GB\", \"free\": \"145.89 KB\", \"shared\": \"0 B\", \"buffers\": \"0 B\", \"cached\": \"0 B\"}}\\n',\n '{\"asctime\": \"2018-05-11 06:03:27 -0700\", \"levelname\": \"INFO\", \"name\": \"requests_fortified\", \"version\": \"0.1.0\", \"message\": \"COMPLETED\", \"connection\": \"\", \"cookies\": \"]>\", \"elapsed\": \"0:00:00.286022\", \"encoding\": \"utf-8\", \"headers\": \"{\\'Date\\': \\'Fri, 11 May 2018 13:03:27 GMT\\', \\'Content-Type\\': \\'application/json;charset=utf-8\\', \\'Transfer-Encoding\\': \\'chunked\\', \\'Connection\\': \\'keep-alive\\', \\'Set-Cookie\\': \\'__cfduid=d46030914d4b01044c167b67bbca43b951526043807; expires=Sat, 11-May-19 13:03:27 GMT; path=/; domain=.restcountries.eu; HttpOnly\\', \\'Access-Control-Allow-Origin\\': \\'*\\', \\'Access-Control-Allow-Methods\\': \\'GET\\', \\'Access-Control-Allow-Headers\\': \\'Accept, X-Requested-With\\', \\'Cache-Control\\': \\'public, max-age=86400\\', \\'Expect-CT\\': \\'max-age=604800, report-uri=\\\\\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\\\\\"\\', \\'Server\\': \\'cloudflare\\', \\'CF-RAY\\': \\'4194d881fc146bd4-SJC\\', \\'Content-Encoding\\': \\'gzip\\'}\", \"history\": [], \"raw\": \"\", \"reason\": \"\", \"request\": \"\", \"status_code\": 200, \"url\": \"https://restcountries.eu/rest/v2/all\"}\\n',\n ]\n 'DEBUG'\n [\n {\n 'alpha2Code': 'AF',\n 'alpha3Code': 'AFG',\n 'altSpellings': ['AF', 'Af\u0121\u0101nist\u0101n'],\n 'area': 652230.0,\n 'borders': ['IRN', 'PAK', 'TKM', 'UZB', 'TJK', 'CHN'],\n 'callingCodes': ['93'],\n 'capital': 'Kabul',\n 'cioc': 'AFG',\n 'currencies': [\n {'code': 'AFN', 'name': 'Afghan afghani', 'symbol': '\u060b'},\n ],\n 'demonym': 'Afghan',\n 'flag': 'https://restcountries.eu/data/afg.svg',\n 'gini': 27.8,\n 'languages': [\n {\n 'iso639_1': 'ps',\n 'iso639_2': 'pus',\n 'name': 'Pashto',\n 'nativeName': '\u067e\u069a\u062a\u0648',\n },\n {\n 'iso639_1': 'uz',\n 'iso639_2': 'uzb',\n 'name': 'Uzbek',\n 'nativeName': 'O\\u02bbzbek',\n },\n {\n 'iso639_1': 'tk',\n 'iso639_2': 'tuk',\n 'name': 'Turkmen',\n 'nativeName': 'T\u00fcrkmen',\n },\n ],\n 'latlng': [33.0, 65.0],\n 'name': 'Afghanistan',\n 'nativeName': '\u0627\u0641\u063a\u0627\u0646\u0633\u062a\u0627\u0646',\n 'numericCode': '004',\n 'population': 27657145,\n 'region': 'Asia',\n 'regionalBlocs': [\n {\n 'acronym': 'SAARC',\n 'name': 'South Asian Association for Regional Cooperation',\n 'otherAcronyms': [],\n 'otherNames': [],\n },\n ],\n 'subregion': 'Southern Asia',\n 'timezones': ['UTC+04:30'],\n 'topLevelDomain': ['.af'],\n 'translations': {\n 'br': 'Afeganist\u00e3o',\n 'de': 'Afghanistan',\n 'es': 'Afganist\u00e1n',\n 'fa': '\u0627\u0641\u063a\u0627\u0646\u0633\u062a\u0627\u0646',\n 'fr': 'Afghanistan',\n 'hr': 'Afganistan',\n 'it': 'Afghanistan',\n 'ja': '\u30a2\u30d5\u30ac\u30cb\u30b9\u30bf\u30f3',\n 'nl': 'Afghanistan',\n 'pt': 'Afeganist\u00e3o',\n },\n },\n\n\nClasses\n-------\n\n- ``class RequestsFortified`` -- Base class using `requests `_ with retry functionality and verbose logging.\n- ``class RequestsFortifiedDownload`` -- Download file handling.\n- ``class RequestsFortifiedUpload`` -- Upload file handling.\n\nRequirements\n------------\n\n``requests-fortified`` module is built upon Python 3 and has dependencies upon\nseveral Python modules available within `Python Package Index PyPI `_.\n\n.. code-block:: bash\n\n make install\n\nor\n\n.. code-block:: bash\n\n python3 -m pip uninstall --yes --no-input -r requirements.txt\n python3 -m pip install --upgrade -r requirements.txt\n\n\nPackages\n^^^^^^^^\n\n- **beautifulsoup4**: https://pypi.python.org/pypi/beautifulsoup4\n- **deepdiff**: https://pypi.python.org/pypi/deepdiff\n- **logging-fortified**: ***TBD***\n- **pyhttpstatus-utils**: https://pypi.python.org/pypi/pyhttpstatus-utils\n- **requests**: https://pypi.python.org/pypi/requests\n- **safe-cast**: https://pypi.python.org/pypi/safe-cast\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/jeff00seattle/requests-fortified/archive/v0.3.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jeff00seattle/requests-fortified", "keywords": "requests fortified", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "requests-fortified", "package_url": "https://pypi.org/project/requests-fortified/", "platform": "", "project_url": "https://pypi.org/project/requests-fortified/", "project_urls": { "Download": "https://github.com/jeff00seattle/requests-fortified/archive/v0.3.1.tar.gz", "Homepage": "https://github.com/jeff00seattle/requests-fortified" }, "release_url": "https://pypi.org/project/requests-fortified/0.3.1/", "requires_dist": null, "requires_python": "", "summary": "Extension of Python HTTP `requests` with verbose logging using `logging-fortified`.", "version": "0.3.1" }, "last_serial": 3855946, "releases": { "0.3.1": [ { "comment_text": "", "digests": { "md5": "ff471da7ab06d12cb5c317a67dccc4e2", "sha256": "47a6808d22920da141b1ad83c7060a4e84c58badd5966ede96be6a6557612a14" }, "downloads": -1, "filename": "requests_fortified-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ff471da7ab06d12cb5c317a67dccc4e2", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 39162, "upload_time": "2018-05-12T03:55:46", "url": "https://files.pythonhosted.org/packages/65/25/bcb2597392ec621df0f04da05a39e362ca36c4063d037b39ce064884e30d/requests_fortified-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f62025e7370f5c13912d4a77c9095322", "sha256": "b90b38d189914435cbc6b0d9aa78b55e0ef4a96e3cada38ffbb5d194195f217b" }, "downloads": -1, "filename": "requests-fortified-0.3.1.tar.gz", "has_sig": false, "md5_digest": "f62025e7370f5c13912d4a77c9095322", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 54065, "upload_time": "2018-05-12T03:55:44", "url": "https://files.pythonhosted.org/packages/8e/12/8809b452624507a9eac7b1f3a3e932636f51f16e2cd5dc39d52fd27dd1c5/requests-fortified-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ff471da7ab06d12cb5c317a67dccc4e2", "sha256": "47a6808d22920da141b1ad83c7060a4e84c58badd5966ede96be6a6557612a14" }, "downloads": -1, "filename": "requests_fortified-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ff471da7ab06d12cb5c317a67dccc4e2", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 39162, "upload_time": "2018-05-12T03:55:46", "url": "https://files.pythonhosted.org/packages/65/25/bcb2597392ec621df0f04da05a39e362ca36c4063d037b39ce064884e30d/requests_fortified-0.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f62025e7370f5c13912d4a77c9095322", "sha256": "b90b38d189914435cbc6b0d9aa78b55e0ef4a96e3cada38ffbb5d194195f217b" }, "downloads": -1, "filename": "requests-fortified-0.3.1.tar.gz", "has_sig": false, "md5_digest": "f62025e7370f5c13912d4a77c9095322", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 54065, "upload_time": "2018-05-12T03:55:44", "url": "https://files.pythonhosted.org/packages/8e/12/8809b452624507a9eac7b1f3a3e932636f51f16e2cd5dc39d52fd27dd1c5/requests-fortified-0.3.1.tar.gz" } ] }