{
"info": {
"author": "Francisco Depascuali",
"author_email": "francisco.depascuali@gmail.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.6",
"Topic :: Software Development :: Libraries :: Python Modules"
],
"description": "|Python| |License|\n\nwikiquotes-python-api\n=====================\n\nThis library is intended to be a python API for wikiquotes (inspired by\n`python-wikiquotes `__).\n\nTable of Contents\n-----------------\n\n- `Usage <#usage>`__\n- `Motivation <#motivation>`__\n- `Search <#search>`__\n- `Output <#output>`__\n- `Testing <#testing>`__\n\nUsage\n-----\n\n.. code:: python\n\n >>> import wikiquotes\n\n >>> wikiquotes.search(\"gandi\", \"english\")\n [u'Mahatma Gandhi', u'Indira Gandhi', u'Rahul Gandhi', u'Rajiv Gandhi', u'Arun Manilal Gandhi', u'Gandhi (film)', u'Anand Gandhi', u'Virchand Gandhi', u'Maneka Gandhi', u'Blindness']\n\n >>> wikiquotes.get_quotes('Hau Pei-tsun', \"english\")\n # [u\"The slogans of 'countering back the mainland' created by Chiang Kai-shek and 'liberating Taiwan' by Mao Zedong several decades ago should be forgotten because none of them could be put into practice.\",\n # u'When people on both sides of the Strait reach a consensus on their political system, unification will come to fruition naturally.',\n # u'Taiwanese independence is a dead end.']\n\n >>> wikiquotes.quote_of_the_day(\"english\")\n # (u'Even after killing ninety nine tigers the Maharaja should beware of the hundredth.', u'Kalki Krishnamurthy')\n\n >>> wikiquotes.quote_of_the_day(\"spanish\")\n # (u'Por San Ferm\\xedn, el calor no tiene fin', u'Refr\\xe1n espa\\xf1ol')\n\n >>> wikiquotes.random_quote(\"Aristotle\", \"english\")\n # u'For the things we have to learn before we can do, we learn by doing.'\n\n >>> wikiquotes.supported_languages()\n # ['english', 'spanish']\n\nMotivation\n----------\n\nThere seems to be two options for retrieving quotes from WikiQuotes using python: To implement it\nyourself or to use `python-wikiquotes `__. At a\nfirst glance, I chose the second option and used that library. However, usage and code inspection\nover `python-wikiquotes `__ lead me to choose the\nfirst approach and develop a library.\n\nThe main reasons for this decision were that: 1. Quotes retrieved weren't all the quotes in\nwikiquotes API (tried with different authors). 2. It doesn't work for python 2.x 2. The code was too\ncomplex for what it was achieving. The choice in that project was to use urllib to retrieve the\nquotes, and lxml to parse the html.\n\nThis project: 1. Adds tests for retrieving all the quotes from several authors (Though this point is\ndifficult to satisfy, because quotes don't respect a format for all authors). 2. Works for python\n2.x and 3.x 3. Uses requests and BeautifulSoup, which abstract great part of the complexity which is\npresent in `python-wikiquotes `__.\n\nAnyway, the correct approach would be to try both and stick with the one that gives you the best\nresults.\n\nSearch\n------\n\nQuotes are retrieved by searching first for the correct author. This strives for robustness, because\nit allows to return a quote whether the input is the correct name of the author or not. At the same\ntime, note that subsequent calls to WikiQuotes api have to be made to grab suggestions (see\n`here `__).\n\nExample: \"shakspare\" -> \"shakespeare\" -> ['William Shakespeare', 'Last words in Shakespeare',\n'Shakespeare in Love', ...] -> get\\_quotes = 4 calls.\n\nOutput\n------\n\nWhile in python 3.x str type = unicode, in python 2.x str type != unicode. Therefore (and to be\nconsistent), all string output are unicode strings, independent of python's version. If you call any\nfunction from the API that have non-english characters, you will see some weird characters.\n\n.. code:: python\n\n >>> wikiquotes.random_quote(\"borges\", \"espa\u00f1ol\")\n # u'\\xabTodos caminamos hacia el anonimato, solo que los mediocres llegan un poco antes\\xbb.'\n\nThis is not incorrect, it is the underlying representation of the format of the string. You could\nencode the string in utf-8 and print it (or just print it and your python interpreter should convert\nit automatically).\n\n.. code:: python\n\n >>> print(u'\\xabTodos caminamos hacia el anonimato, solo que los mediocres llegan un poco antes\\xbb.'.encode('utf8'))\n # \u00abTodos caminamos hacia el anonimato, solo que los mediocres llegan un poco antes\u00bb.\n\nTesting\n-------\n\nThe approach for testing changed: at a first glance, testing was done by manually adding the code to\ntest each author. After that, I realized that the structure was the same for every author: We need\nthe name, the language and the quotes. Using some *black* magic for parametrizing tests, I could\nextract all the logic to code and have a text file for each author. (See\n`author\\_test `__\nfor more info.)\n\nThe way of testing right now is to add a txt file of the author to test's\n`authors `__. For\nexample,\n`here `__\nis the test for Dijkstra quotes in english. Adding a new author is a txt file for the author (the\nname is irrelevant, but should be the author name) and respecting the following format. 1. First\nline: Author's name (or the suffix of the wikiquotes page, because sometimes wikipedia has ambiguate\nredirections if author name is used ). 2. Second line: language. 3. Third line: empty. 4. Following\nlines should contain one quote per line.\n\n.. |Python| image:: https://img.shields.io/badge/python-2.x%2F3.x-blue.svg\n.. |License| image:: https://img.shields.io/badge/license-MIT-blue.svg\n :target: https://opensource.org/licenses/MIT\n",
"description_content_type": null,
"docs_url": null,
"download_url": "https://github.com/FranDepascuali/wikiquotes-python-api/archive/1.4.tar.gz",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/FranDepascuali/wikiquotes-python-api",
"keywords": "",
"license": "MIT License\n\nCopyright (c) 2017 Francisco Depascuali\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
"maintainer": "",
"maintainer_email": "",
"name": "wikiquotes",
"package_url": "https://pypi.org/project/wikiquotes/",
"platform": "any",
"project_url": "https://pypi.org/project/wikiquotes/",
"project_urls": {
"Download": "https://github.com/FranDepascuali/wikiquotes-python-api/archive/1.4.tar.gz",
"Homepage": "https://github.com/FranDepascuali/wikiquotes-python-api"
},
"release_url": "https://pypi.org/project/wikiquotes/1.4/",
"requires_dist": null,
"requires_python": "",
"summary": "Wikiquotes python API",
"version": "1.4"
},
"last_serial": 3209753,
"releases": {
"1.1": [
{
"comment_text": "",
"digests": {
"md5": "639481f688c9494da6afd6dc049edb66",
"sha256": "2e92c9c07a64acb80666315c1a686af4f43f9d7f197cd8a99b079d47ccd25c34"
},
"downloads": -1,
"filename": "wikiquotes-1.1.tar.gz",
"has_sig": false,
"md5_digest": "639481f688c9494da6afd6dc049edb66",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14142,
"upload_time": "2017-09-13T17:59:18",
"url": "https://files.pythonhosted.org/packages/f5/7d/ed81208d2ff7c200229f9774a6131c39ff25c4a6fd695176ab16fbc036f6/wikiquotes-1.1.tar.gz"
}
],
"1.2": [
{
"comment_text": "",
"digests": {
"md5": "d4a495f98d4540784e19384b9edf4412",
"sha256": "1024658f0c75c9aa74b4d8640286d601f3089b21b3c6a786e65535ab3d85c04e"
},
"downloads": -1,
"filename": "wikiquotes-1.2.tar.gz",
"has_sig": false,
"md5_digest": "d4a495f98d4540784e19384b9edf4412",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14207,
"upload_time": "2017-09-13T18:26:25",
"url": "https://files.pythonhosted.org/packages/de/60/e8130b3b6c46d4a2fa8dab60cf745b66cacd9a7950ba78381d6f82cce004/wikiquotes-1.2.tar.gz"
}
],
"1.3": [
{
"comment_text": "",
"digests": {
"md5": "0261d522243142e3672db37574426393",
"sha256": "1c150461131ef34d5950faa9a01d4cd632a0199830090fe66976d457f95bee75"
},
"downloads": -1,
"filename": "wikiquotes-1.3.tar.gz",
"has_sig": false,
"md5_digest": "0261d522243142e3672db37574426393",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15199,
"upload_time": "2017-09-27T18:54:21",
"url": "https://files.pythonhosted.org/packages/30/62/bff707d09b5162bc94d44d231c5c147e7b22d766e16b92d032489edcec26/wikiquotes-1.3.tar.gz"
}
],
"1.4": [
{
"comment_text": "",
"digests": {
"md5": "50ffb06a9e70fec4f31bdd35b74283de",
"sha256": "7fcec63405c80d2309e5199328b60dbbbc8b7c6bd2f12ed8d89d64e9193530ac"
},
"downloads": -1,
"filename": "wikiquotes-1.4.tar.gz",
"has_sig": false,
"md5_digest": "50ffb06a9e70fec4f31bdd35b74283de",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15297,
"upload_time": "2017-09-28T11:12:51",
"url": "https://files.pythonhosted.org/packages/e6/45/0ed50f224a4559fcaea28b851b6b896cb5a0f5c8a5c382034f82e92a664d/wikiquotes-1.4.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "50ffb06a9e70fec4f31bdd35b74283de",
"sha256": "7fcec63405c80d2309e5199328b60dbbbc8b7c6bd2f12ed8d89d64e9193530ac"
},
"downloads": -1,
"filename": "wikiquotes-1.4.tar.gz",
"has_sig": false,
"md5_digest": "50ffb06a9e70fec4f31bdd35b74283de",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15297,
"upload_time": "2017-09-28T11:12:51",
"url": "https://files.pythonhosted.org/packages/e6/45/0ed50f224a4559fcaea28b851b6b896cb5a0f5c8a5c382034f82e92a664d/wikiquotes-1.4.tar.gz"
}
]
}