{ "info": { "author": "Kashish Arora", "author_email": "kashisharora99@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "nytimes-top-stories\n===================\n\n``nytimes-top-stories`` is a simple Python wrapper for New York Times\u2019 Top\nStories API.\n\nCompatible with Python 2.7 and 3+.\n\nDependencies\n------------\n\n``nytimes-top-stories`` requires the ``requests`` package.\n\n\nInstallation\n------------\n\nPip\n~~~\n\n``pip install nytimes-top-stories``\n\nClone repository\n~~~~~~~~~~~~~~~~\n\n- ``git clone git@github.com:kashiish/nytimes-top-stories.git``\n- ``cd`` into your ``nytimes-top-stories`` directory\n- ``python setup.py install``\n\nUsage\n-----\n\nRegister for a Top Stories API key at\nhttps://developer.nytimes.com/signup.\n\n.. code:: python\n\n from topstories import TopStoriesAPI\n api = TopStoriesAPI()\n\n\nThe ``get_stories`` method takes one required argument and two optional\narguments. Checkout the `API documentation`_ to see the data that is\nreturned from the API.\n\n\n.. code:: python\n\n def get_stories(self, section, format_type=\"json\", return_json_string=False):\n \"\"\"\n Gets a list of current top articles and associated images in the\n specified section and in the specified format.\n\n params:\n section: (string) the section the articles appears in\n format: (string) json or jsonp, default is json\n return_json_string: (boolean) if True, return value will be JSON string instead of a python list,\n default is False\n return:\n format_type=json: A list of articles (articles are python dicts) is returned.\n If return_json_string, string is returned.\n format_type=jsonp: API returns a callback function (string) in the format\n \"{section}TopStoriesCallback({data})\".\n {data} is an object, not an array, and it is not parsed/decoded.\n \"\"\"\n\n.. code:: python\n\n stories = api.get_stories(\"politics\") # list of story dicts\n stories_string = api.get_stories(\"home\", return_json_string=True) # json string\n stories_jsonp = api.get_stories(\"work\", format_type=\"jsonp\") # (string) callback function with data input\n\n\nIn addition, there are two more public methods:\n\n.. code:: python\n\n #returns a list of valid sections\n >>> api.get_sections_list()\n >>> [\"home\",\"opinion\",\"world\",\"national\",\"politics\",\"upshot\",\"nyregion\",\"business\",\n \"technology\",\"science\",\"health\",\"sports\",\"arts\",\"books\",\"theater\",\"sundayreview\",\n \"fashion\",\"tmagazine\",\"food\",\"travel\",\"magazine\",\"realestate\",\"automobiles\",\n \"obituaries\",\"insider\"]\n\n\n.. code:: python\n\n # writes a list of stories to a json file\n # input a path to file and list of stories\n api.write_to_json_file(\"example.json\", stories)\n\n\nTesting\n-------\n\n``pytest`` and ``mock`` are used for testing this package.\n\n\n``python setup.py pytest``\n\n.. _API documentation: https://developer.nytimes.com/top_stories_v2.json#\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/kashiish/nytimes-top-stories", "keywords": "new york times nytimes top stories api", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "nytimes-top-stories", "package_url": "https://pypi.org/project/nytimes-top-stories/", "platform": "", "project_url": "https://pypi.org/project/nytimes-top-stories/", "project_urls": { "Homepage": "http://github.com/kashiish/nytimes-top-stories" }, "release_url": "https://pypi.org/project/nytimes-top-stories/1.0.1/", "requires_dist": [ "requests (>=2.1.0)" ], "requires_python": "", "summary": "Python wrapper for NYTimes Top Stories API", "version": "1.0.1" }, "last_serial": 3726966, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "1b7c781648aaad7ef73c4286afb4a802", "sha256": "cc90f11ab32ad193cece4997b34c9259db4175abcc4104408befb6b065df2b90" }, "downloads": -1, "filename": "nytimes_top_stories-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1b7c781648aaad7ef73c4286afb4a802", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6610, "upload_time": "2018-04-01T12:00:13", "url": "https://files.pythonhosted.org/packages/6f/68/1da3aa6d8cd7cdfb9b3e694633edd2ca9c5b8d4530dfeabb29e4a6f4a5bb/nytimes_top_stories-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5b16f24da0f1071b7969674b2c04c343", "sha256": "fe1a11414817f02ff8f378624bc0c72d10cb3431118f137b661299ca112cff94" }, "downloads": -1, "filename": "nytimes-top-stories-1.0.0.tar.gz", "has_sig": false, "md5_digest": "5b16f24da0f1071b7969674b2c04c343", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3770, "upload_time": "2018-04-01T12:00:14", "url": "https://files.pythonhosted.org/packages/97/92/9a60a65ffda337c4dd8b1e1acb0aca2f3a38d51259f8df276e9e534e74ab/nytimes-top-stories-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "82d8658493d5a5b57048754351696915", "sha256": "83a52af4139515aeb1a4c584d119a6bcbdc907025bc440598a8a0cd6950e0ea1" }, "downloads": -1, "filename": "nytimes_top_stories-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "82d8658493d5a5b57048754351696915", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6615, "upload_time": "2018-04-02T17:55:46", "url": "https://files.pythonhosted.org/packages/57/f3/309510b647c12220001ac49ece55a8b61c47b8310a2e05cf31345efa0b86/nytimes_top_stories-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "88f5f6a9bf9967203a772eb9fec5d0bd", "sha256": "01ed95ae373af24e69f565e2d2eabcb898f6759ae4d0ae81171f31ecacfa6de7" }, "downloads": -1, "filename": "nytimes-top-stories-1.0.1.tar.gz", "has_sig": false, "md5_digest": "88f5f6a9bf9967203a772eb9fec5d0bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3793, "upload_time": "2018-04-02T17:55:47", "url": "https://files.pythonhosted.org/packages/85/45/516fedb536ddf6b75489539ebbf99fbad44bf30a0a5dcc8d08c4765e0f36/nytimes-top-stories-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "82d8658493d5a5b57048754351696915", "sha256": "83a52af4139515aeb1a4c584d119a6bcbdc907025bc440598a8a0cd6950e0ea1" }, "downloads": -1, "filename": "nytimes_top_stories-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "82d8658493d5a5b57048754351696915", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6615, "upload_time": "2018-04-02T17:55:46", "url": "https://files.pythonhosted.org/packages/57/f3/309510b647c12220001ac49ece55a8b61c47b8310a2e05cf31345efa0b86/nytimes_top_stories-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "88f5f6a9bf9967203a772eb9fec5d0bd", "sha256": "01ed95ae373af24e69f565e2d2eabcb898f6759ae4d0ae81171f31ecacfa6de7" }, "downloads": -1, "filename": "nytimes-top-stories-1.0.1.tar.gz", "has_sig": false, "md5_digest": "88f5f6a9bf9967203a772eb9fec5d0bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3793, "upload_time": "2018-04-02T17:55:47", "url": "https://files.pythonhosted.org/packages/85/45/516fedb536ddf6b75489539ebbf99fbad44bf30a0a5dcc8d08c4765e0f36/nytimes-top-stories-1.0.1.tar.gz" } ] }