{ "info": { "author": "Tristan Tao", "author_email": "tristan@teamleada.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# py-ms-cognitive\nThin wrapper for the Microsoft Cognitive Services (originally called Project Oxford with an endpoint at projectoxford.ai). If you have additional support you want, please make an issue.\n\nA continuation of __[PyBingSearch](https://github.com/tristantao/py-bing-search)__ which will no longer be updated as of Nov 14th 2016.\n\nIntro\n=====\nExtremely thin python wrapper for Microsoft Cognitive Services API. Please note that this module does not use the older Microsoft Azure DataMarket WebSearch API (deprecated Dec 15 2016). This module requires that you sign up for Microsoft Cognitive Services and acquire application key(s) for the corresponding service(s).\n\nThe modules require different microsoft keys for different services, so you'll need to get yours here (free for up to 1K/Mon for search): __[Subscribe for Free](https://www.microsoft.com/cognitive-services/en-us/sign-up)__\n\nInstallation\n=====\n#####for python 2.7.* \n\n```sh\npip install py-ms-cognitive\n```\n\n#####for python 3.*\n\n```sh\npip3 install py-ms-cognitive\n```\n\n*Requires the requests library.\n\nUsage\n=====\n\nRemember to set the `API_KEY` as your own.\n\n###Searches [Web / Image / News / Video]\n\n####For Web Results:\n\n```py\n>>> from py_ms_cognitive import PyMsCognitiveWebSearch\n>>> search_term = \"Python Software Foundation\"\n>>> search_service = PyMsCognitiveWebSearch('API_KEY', search_term)\n>>> first_fifty_result = search_service.search(limit=50, format='json') #1-50\n>>> second_fifty_resul t= search_service.search(limit=50, format='json') #51-100\n\n>>> print (second_fifty_result[0].snippet)\n u'Python Software Foundation Home Page. The mission of the Python Software Foundation is to promote, protect, and advance the Python programming language, and to ...'\n>>> print (first_fifty_result[0].__dict__.keys()) #see what variables are available.\n['name', 'display_url', 'url', 'title', 'snippet', 'json', 'id', 'description']\n\n # To get individual result json:\n>>> print (second_fifty_result[0].json)\n...\n\n # To get the whole response json from the MOST RECENT response\n # (which will hold 50 individual responses depending on limit set):\n>>> print (search_service.most_recent_json)\n...\n```\n__*limit*__ parameter controls how many results to return in this single query, up to __*50*__. if you need more than 50, call __*search_all()*__ below, and use the __*quota*__ parameter to specify how many results.\n\n####For Image Results:\n\n```py\n>>> from py_ms_cognitive import PyMsCognitiveImageSearch\n>>> search_term = \"puppies\"\n>>> search_service = PyMsCognitiveImageSearch('API_KEY', search_term)\n>>> first_fifty_result = search_service.search(limit=50, format='json') #1-50\n>>> second_fifty_result = search_service.search(limit=50, format='json') #51-100\n\n>>> print (second_fifty_result[0].name)\n u'So cute - Puppies Wallpaper (14749028) - Fanpop'\n>>> print (first_fifty_result[0].__dict__.keys()) #see what variables are available.\n['name', 'web_search_url', 'content_size', 'image_insights_token', 'content_url', 'image_id', 'json', 'host_page_url', 'thumbnail_url']\n```\n\nThe package also support Video (__PyMsCognitiveVideoSearch__), and News (__PyMsCognitiveNewsSearch__). Simply replace the imports and they'll work the same.\n\n## Searching for a specific number of results.\n\nYou secan also run __*search_all*__ to keep searching until it fills your required quota. Note that this will make an unpredictable number of api calls (hence drains your credits).\n\n```py\n>>> from py_ms_cognitive import PyMsCognitiveWebSearch\n>>> search_term = \"puppies\"\n>>> search_service = PyMsCognitiveWebSearch('API_KEY', search_term)\n>>> result_list = search_service.search_all(quota=130) # will return result 1 - 130 \n# (around 130 results, sometimes more)\n>>> result_list = search_service.search_all(quota=130, format='json') #will return result 131 to 260 \n# sometimes a bit different, but roughly the number. Read below for the details.\n```\nSometimes microsoft returns 36 results when you query for 30 (just an inexact number). This means py-ms-cognitive will truncate some results. Here's an example:\n\n```\nresult_list = search_service.search_all(quota=80) \n```\n\nThis will likely be forced to run twice, first time getting __*50*__ (the max) from Micorosoft, and perhaps second time returning __*33*__ for some reason. py-ms-cognitive will truncate and return 80. But it also received __*83*__ in combined results. That means the next time you run the command from the same instance:\nresult_list = search_service.search(limit=20),\nIt won't return result number __*80-100*__, but rather result number __*83 - 103*__. But you would have no way of knowing this.\n\n\n__*search_all()*__ is available in all PyBing*Search classes.\n\n## Custom parameters\nCustom parameters can be added via the __*custom_params*__ parameter (note that this param has been updated from a *string* to a *hash*): \n```py\n>>> from py_ms_cognitive import PyMsCognitiveWebSearch\n>>> search_term = \"xbox\"\n>>> search_service = PyMsCognitiveWebSearch('API_KEY', search_term, custom_params={\"mkt\": \"en-GB\"})\n# You can have multiple custom params by including more params in the hash.\n>>> result_list = search_service.search(limit=50)\n```\n*Note that certain query parameters are used internally (such as offset), and your custom param will overwrite them*. This can lead to some unexpected behaviors. \n\n## silent_fail mode\nyou can enable *__silent_fail__* (off by default) by:\n\n```py\n>>> from py_ms_cognitive import PyMsCognitiveWebSearch\n>>> search_term = \"puppies\"\n>>> search_service = PyMsCognitiveWebSearch('API_KEY', search_term, silent_fail=True)\n...\n```\n\n*__silent_fail__* mode will do the following:\n * Bad parameters will not be checked\n * Any error will only print out and sleep for a few seconds to retry.\n * It will (to its best ability) not raise any exceptions.\n\n#### Additional support on the way. If you have additional support you want, please make an issue.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/tristantao/py-ms-cognitive", "keywords": "Microsoft,Cognitive Services,API,Search", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "py-ms-cognitive", "package_url": "https://pypi.org/project/py-ms-cognitive/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/py-ms-cognitive/", "project_urls": { "Homepage": "https://github.com/tristantao/py-ms-cognitive" }, "release_url": "https://pypi.org/project/py-ms-cognitive/0.4.0/", "requires_dist": [ "requests" ], "requires_python": "", "summary": "A simple lightweight python wrapper for the Microsoft Cognitive Services.", "version": "0.4.0" }, "last_serial": 2764923, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "57d00bc69da88651cd96c845848ad7d2", "sha256": "9406650971bc30b1a665f740931fd00129aea153b48e41a8399e8fc0fbdd2bf8" }, "downloads": -1, "filename": "py_ms_cognitive-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "57d00bc69da88651cd96c845848ad7d2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5583, "upload_time": "2017-01-23T18:05:59", "url": "https://files.pythonhosted.org/packages/fd/1a/b19954c00b0eea5b08b11fe5371889c59fa4cdc63ee3e8fb5b74f8e1b5f5/py_ms_cognitive-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "38a6521be9d4e3ae0459efe185015b53", "sha256": "c5095cab9c2a84cb8619298ad8a90d5f4f57720d167b17d4d4e334fff95e31a3" }, "downloads": -1, "filename": "py-ms-cognitive-0.1.0.tar.gz", "has_sig": false, "md5_digest": "38a6521be9d4e3ae0459efe185015b53", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4332, "upload_time": "2016-11-15T01:45:44", "url": "https://files.pythonhosted.org/packages/ad/43/e265001886b45f0c3e4150f322f6ae292a3667da068c3d32eea4810ca139/py-ms-cognitive-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "262463619c620374fcb0c4107efe5def", "sha256": "597d82998890ed773302fef9f779c8376245bea742206e64c074a32bdac4c0bb" }, "downloads": -1, "filename": "py_ms_cognitive-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "262463619c620374fcb0c4107efe5def", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6432, "upload_time": "2016-11-15T02:09:36", "url": "https://files.pythonhosted.org/packages/7f/af/cf50a13696230fe79c059cbafd9818f899ed23e97f904b05cd55a1074bfb/py_ms_cognitive-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "91f6307da9b6fa2047d5053f53ce92c7", "sha256": "1f63cd2aaba98c355bdfa2040bd590dab12a9b7727b297a05e43e15014e60e57" }, "downloads": -1, "filename": "py-ms-cognitive-0.1.1.tar.gz", "has_sig": false, "md5_digest": "91f6307da9b6fa2047d5053f53ce92c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4347, "upload_time": "2016-11-15T02:09:34", "url": "https://files.pythonhosted.org/packages/f9/b1/9549bec0ee6c9310ea60067e7780972b2bfbd9e050b4e4fbf1820e6d2d34/py-ms-cognitive-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "2c22b1289bfb739cacf39723d5a91576", "sha256": "acb85f76950facc166beabec8da1397832bea1e98b70638e9520662f6fe764f3" }, "downloads": -1, "filename": "py_ms_cognitive-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2c22b1289bfb739cacf39723d5a91576", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6940, "upload_time": "2016-11-15T21:45:25", "url": "https://files.pythonhosted.org/packages/15/ce/3fc20126bbcff3c69fb2b9509d0df209a6762b9f3f8f6eccf267cf64301e/py_ms_cognitive-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e893e77a1320896b52cfbb417cf7018d", "sha256": "861dd0b3d6eb7c1ff2b4343e0e6f040b840fbc7b9487381da1f1f08c2472da0c" }, "downloads": -1, "filename": "py-ms-cognitive-0.2.0.tar.gz", "has_sig": false, "md5_digest": "e893e77a1320896b52cfbb417cf7018d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4856, "upload_time": "2016-11-15T21:45:23", "url": "https://files.pythonhosted.org/packages/3a/2a/698b47a05fa7a40dd78acd9da516df48207e4e32913349d273c7bb662c65/py-ms-cognitive-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "ea0fe751ec3c04c4e6a0258c33d3f0ba", "sha256": "c8087d52fc7d3309c89bea909903c7f02c4f43a6fbdbfbdc90e333a8a19dccaa" }, "downloads": -1, "filename": "py_ms_cognitive-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ea0fe751ec3c04c4e6a0258c33d3f0ba", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13545, "upload_time": "2016-11-15T23:15:32", "url": "https://files.pythonhosted.org/packages/85/41/63d541336df06997f48339e0eef0c3897390b81429a43563ba38452f5999/py_ms_cognitive-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9d4f1404d7801552835057536fbfd139", "sha256": "0e97207ea39f0a8a576c5854efdd56cce15d1b61e5afd11ea10dfddb2f8fb09c" }, "downloads": -1, "filename": "py-ms-cognitive-0.2.1.tar.gz", "has_sig": false, "md5_digest": "9d4f1404d7801552835057536fbfd139", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5753, "upload_time": "2016-11-15T23:15:29", "url": "https://files.pythonhosted.org/packages/f7/f8/82f5b7e98f5c49c856d3ac1d778e732bf0d0f07309459c4dab1b87743300/py-ms-cognitive-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "bf6e1b7c85d4e6996d2435ef9c21244c", "sha256": "1de69dc18ba5a3b247490d903dec6e4aba3d3b4dfad68ba31b5b0f2510a4e600" }, "downloads": -1, "filename": "py_ms_cognitive-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bf6e1b7c85d4e6996d2435ef9c21244c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4876, "upload_time": "2016-11-16T21:45:18", "url": "https://files.pythonhosted.org/packages/4e/0a/25c15b8ce89032a63f4eeed2058d2c8f99684b32b00d89177b9e6621e9dc/py_ms_cognitive-0.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ec54c13b11040e8303771ab9cbc38917", "sha256": "ce4b13e406275700dd5054915e4fb648236f1054a1f2741bbcfbe8291d93a2a5" }, "downloads": -1, "filename": "py-ms-cognitive-0.2.2.tar.gz", "has_sig": false, "md5_digest": "ec54c13b11040e8303771ab9cbc38917", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5755, "upload_time": "2016-11-16T21:45:15", "url": "https://files.pythonhosted.org/packages/9a/4b/467990663939fb8e594c04360bbe1c4b6e1cb6d59404187ca24031dc8ae2/py-ms-cognitive-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "4ebdb2b1f1d8775cef63014548bd1a20", "sha256": "028ed947aebbcad0f5f92597e39fabca80a03e394f2fc8f327f671334fcbff9f" }, "downloads": -1, "filename": "py_ms_cognitive-0.2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4ebdb2b1f1d8775cef63014548bd1a20", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10595, "upload_time": "2016-11-16T21:52:06", "url": "https://files.pythonhosted.org/packages/23/15/2e3e27cc1d21b6b46b0981731e4e05993830206ca0c2c7c1b323b29bdbba/py_ms_cognitive-0.2.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c9045bef7cc812037473f31da00f3629", "sha256": "91cd43cee5b8e2d16684a8e06d2f5056e2b5246b9a4f8c9def2d5baf4c0e22b2" }, "downloads": -1, "filename": "py-ms-cognitive-0.2.3.tar.gz", "has_sig": false, "md5_digest": "c9045bef7cc812037473f31da00f3629", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6082, "upload_time": "2016-11-16T21:52:01", "url": "https://files.pythonhosted.org/packages/0b/cc/ef6efcb5357b620f826cfe4bd0f79a048e409aadee3b7ec971a96300bff2/py-ms-cognitive-0.2.3.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "652858e6ef5eb3f594f10db01eaa6e0b", "sha256": "537040600fe246f7ea8b0a2498b0d2c54f6c3d645681199f301005224c2d1ad7" }, "downloads": -1, "filename": "py_ms_cognitive-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "652858e6ef5eb3f594f10db01eaa6e0b", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11815, "upload_time": "2016-11-16T22:17:27", "url": "https://files.pythonhosted.org/packages/19/4c/b212bccb24869985ab67d0bc9391ec767f5413e58f54ba0310f5ccbe9776/py_ms_cognitive-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dae3d5033b22f0499c28061dad44df31", "sha256": "b84985f4f536866bbcb0e15535eb874978b5f4b914d1117f720a1de7f662a650" }, "downloads": -1, "filename": "py-ms-cognitive-0.3.0.tar.gz", "has_sig": false, "md5_digest": "dae3d5033b22f0499c28061dad44df31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6304, "upload_time": "2016-11-16T22:17:24", "url": "https://files.pythonhosted.org/packages/bc/d1/7f4d05929af4fd348dbcfe11d13919b5ea2882a61ffe8474fa07a6e47823/py-ms-cognitive-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "c200c594cd142d04d439f7d81949c247", "sha256": "2c7c0fc2809290c87c8b81c4d8c9a04e89601db6213e8e48f2059f26bdcc1235" }, "downloads": -1, "filename": "py_ms_cognitive-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c200c594cd142d04d439f7d81949c247", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12745, "upload_time": "2017-01-23T18:07:27", "url": "https://files.pythonhosted.org/packages/5e/62/2a556544a1256539864e792153c12ef8c968742190405eb9f759496558e5/py_ms_cognitive-0.3.1-py2.py3-none-any.whl" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "e7786ddf10d21264cceb65682f2c5bc5", "sha256": "e16362963f9f8700dd2c07f7ae06cc166fcd6aee34e7735575e692488baf0f57" }, "downloads": -1, "filename": "py_ms_cognitive-0.3.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e7786ddf10d21264cceb65682f2c5bc5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15546, "upload_time": "2017-01-23T22:35:45", "url": "https://files.pythonhosted.org/packages/ed/95/3e5e7882c5b1fda518db6774aa477547cd739a48f7de151f7a72d18a8582/py_ms_cognitive-0.3.2-py2.py3-none-any.whl" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "55ab2fa9b995567ee05e02c0fcf4994a", "sha256": "d5680584c2a800a1867ba5030497ceca2378d9f53a7d667b906777afc08744c1" }, "downloads": -1, "filename": "py_ms_cognitive-0.3.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "55ab2fa9b995567ee05e02c0fcf4994a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15867, "upload_time": "2017-01-31T17:56:38", "url": "https://files.pythonhosted.org/packages/78/a0/bc2f2c04ea320ed3275b0d23679519458e8612e23d162a838b5dd9e34ea6/py_ms_cognitive-0.3.3-py2.py3-none-any.whl" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "489ba12e06e5838c265565d3701871d1", "sha256": "09d23832a7d2f3c5d4247a99ce92bc24570a4e6d65c8053dc40a3d24582dac9e" }, "downloads": -1, "filename": "py_ms_cognitive-0.3.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "489ba12e06e5838c265565d3701871d1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16303, "upload_time": "2017-01-31T18:52:43", "url": "https://files.pythonhosted.org/packages/82/0d/993f7d385329d4a5b6639b278a589510c75300cb100427e46b82b6d1f6a5/py_ms_cognitive-0.3.4-py2.py3-none-any.whl" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "a2ec0cf7100630f06e800838bf65d937", "sha256": "adadc8625fcbeff5ef6f3d5cae6de55653b3627330f0adc526e6cc23d78f74b3" }, "downloads": -1, "filename": "py_ms_cognitive-0.4.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a2ec0cf7100630f06e800838bf65d937", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17616, "upload_time": "2017-04-10T01:36:29", "url": "https://files.pythonhosted.org/packages/35/d2/f90c35d56f1d5c8d91e2aa135571c786b2b368d942fc01c5636ac7b625ca/py_ms_cognitive-0.4.0-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a2ec0cf7100630f06e800838bf65d937", "sha256": "adadc8625fcbeff5ef6f3d5cae6de55653b3627330f0adc526e6cc23d78f74b3" }, "downloads": -1, "filename": "py_ms_cognitive-0.4.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a2ec0cf7100630f06e800838bf65d937", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17616, "upload_time": "2017-04-10T01:36:29", "url": "https://files.pythonhosted.org/packages/35/d2/f90c35d56f1d5c8d91e2aa135571c786b2b368d942fc01c5636ac7b625ca/py_ms_cognitive-0.4.0-py2.py3-none-any.whl" } ] }