{ "info": { "author": "Arindam Pradhan", "author_email": "arindampradhan10@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "![yaaHN API](https://github.com/arindampradhan/yaaHN/blob/master/hn.png)\n\nYaa it's just a python wrapper for the official [firebase hacker news api](https://github.com/HackerNews/API).\n\n\n## Install\n\n python setup.py install\n\n or \n\n pip install yaaHN\n\n\n## Features:\n\n* No oauth required, use a simple client.\n* Async requests (uses gevent) \n* Fetch comments, stories, poll, user data and lot more. \n* Comments easily support support pagination and comment kids.\n* Hook them to your **django** and **flask** using models api.\n* Easily initialize to your database from the api sql or nosql.\n* Most objects have a simple schema for json and xml.\n\n## **Client** for hacker New\n\n\n### **``get_comments``**\n\n#### Get all comment objects\n\n#### Parameters:\n\nName | Type | Required | Description | Default\n-----|------|----------|-------------|----------\nitem_id | int | Yes | The id of the item (story id or comment id) that has comments kid | None\nlimit | int | No | limit Number of comments to return | 5\njson | bool | No | If yes returns the json result | False\n\n#### Examples\n\n from yaaHN import hn_client\n hn_client.get_comments(6374031)\n\n [,\n ,\n ,\n ,\n ,\n ,\n ]\n\nThis method uses **gevent requests** \n\n### **``top_stories``**\n\n#### Yields top 100 stories objects\n\n\n#### Parameters:\n\nName | Type | Required | Description | Default\n------|------|----------|-------------|---------\nlimit | int | No | limit Number of comments to return | 5\nfirst | int | No | set first range from top stories ids | None\nlast | int | No | set last range from top stories ids | None\njson | bool | No | If yes returns the json result | False\n\n\n#### Examples\n\nThis is a generator object\n\n from yaaHN import hn_client\n for r in hn_client.top_stories(30):\n print \"%s - %s\" %(r.id , r.title) \n print \n\nThis method uses **gevent requests**\n\n\n### **``get_user``**\n\nReturns an **User object**\n\n from yaaHN import hn_client\n hn_client.get_user('joe')\n\n \n\n### **``get_item``**\n\nReturns an **Item object**\n\n from yaaHN import hn_client\n hn_client.get_item(1)\n\n \n\n**Note:** This item object accepts any type of item and can be used as a dummy object, for unrelaible exceptions due to async requests.(Usage in top_stories)\n\n### **``get_poll``** , **``get_comment``**,**``get_story``** .\n\n from yaaHN import hn_client\n hn_client.get_item(8863)\n hn_client.get_story(879)\n hn_client.get_comment(2921983)\n\nPoll, Story, Comment are subclass (not inherited) of item class . They all have some(not all) of the properties of the item class.\n\n### **``top_stories_ids``**\n\n#### Returns the list of ids from top stories ( No parameter needed)\n\n#### Examples\n\n from yaaHN import hn_client\n hn_client.top_stories_ids()\n\n [8976489,8976451,8976690,8976611,8974024,8973283, ... \n\n### **``get_max_item``**\n\nReturns the **max item id**\n\n#### Examples\n\n from yaaHN import hn_client\n hn_client.get_max_item()\n\n### **``updates``**\n\nGet the **updates object**\n\n#### Examples\n \n from yaaHN import hn_client\n hn_client.updates()\n\n items updated : 10\n\n a = hn_client.updates()\n\n## **``models``** for yaaHN\n\n\n##Tests\n\nTo run the tests locally\n\n $ ./run-tests.sh\n\nTo run individual test\n\n $ python -m unittest tests.\n\n##Item\n\n**properties**\n\nField | Description\n------|------------\nid | The item's unique id. Required.\ndeleted | `true` if the item is deleted.\ntype | The type of item. One of \"job\", \"story\", \"comment\", \"poll\", or \"pollopt\".\nby | The username of the item's author.\ntime | Creation date of the item, in [Unix Time](http://en.wikipedia.org/wiki/Unix_time).\ntext | The comment, Ask HN, or poll text. HTML.\ndead | `true` if the item is dead.\nparent | The item's parent. For comments, either another comment or the relevant story. For pollopts, the relevant poll.\nkids | The ids of the item's comments, in ranked display order.\nurl | The URL of the story.\nscore | The story's score, or the votes for a pollopt.\ntitle | The title of the story or poll.\nparts | A list of related pollopts, in display order.\n\n### ``Poll``, ``Comment`` , ``Story`` \n\nThese are items themselves.(Not inherited but subclass )\n\n##User\n\n**properties**\n\nField | Description\n------|------------\nid | The user's unique username. Case-sensitive. Required.\ndelay | Delay in minutes between a comment's creation and its visibility to other users.\ncreated | Creation date of the user, in [Unix Time](http://en.wikipedia.org/wiki/Unix_time).\nkarma | The user's karma.\nabout | The user's optional self-description. HTML.\nsubmitted | List of the user's stories, polls and comments.\n\n\n### **``types``**\n* - **models.comment** - get the comment model\n* - **models.item** - get the item model\n* - **models.story** - get the story model\n* - **models.user** - get the user model\n* - **models.deleted** - get the deleted model \n* - **models.poll** - get the poll model\n* - **models.update** - get the update model", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/arindampradhan/yaaHN/tarball/v0.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/arindampradhan/yaaHN", "keywords": "api,hacker news,news,stories", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "yaaHN", "package_url": "https://pypi.org/project/yaaHN/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/yaaHN/", "project_urls": { "Download": "https://github.com/arindampradhan/yaaHN/tarball/v0.1", "Homepage": "https://github.com/arindampradhan/yaaHN" }, "release_url": "https://pypi.org/project/yaaHN/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Yet another API wrapper for offical Hacker News", "version": "0.1.1" }, "last_serial": 1845572, "releases": { "0.1": [], "0.1.1": [] }, "urls": [] }