{ "info": { "author": "Avinash Sajjanshetty", "author_email": "a@sajjanshetty.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "#haxor\n\n[![travis](https://img.shields.io/travis/avinassh/haxor.svg)](http://travis-ci.org/avinassh/haxor)\n[![coverall](https://img.shields.io/coveralls/avinassh/haxor.svg)](https://coveralls.io/r/avinassh/haxor?branch=master)\n[![version](https://img.shields.io/pypi/v/haxor.svg)](https://pypi.python.org/pypi/haxor/)\n[![supported](https://img.shields.io/pypi/pyversions/haxor.svg)](https://pypi.python.org/pypi/haxor/)\n![license](https://img.shields.io/pypi/l/haxor.svg)\n\nUnofficial Python wrapper for official Hacker News API.\n\nInstallation\n============\n```python\npip install haxor\n```\nUsage\n=====\n\nimport and initialization:\n```python\nfrom hackernews import HackerNews\nhn = HackerNews()\n```\nGet certain user info by user id (i.e. username on Hacker News)\n```python\nuser = hn.get_user('pg')\n# >>> user.user_id\n# pg\n# >>> user.karma\n# 155040\n```\nStories, comments, jobs, Ask HNs and even polls are just items and they\nhave unique item id. To get info of an item by item id:\n```python\nitem = hn.get_item(8863)\n# >>> item.title\n# \"My YC app: Dropbox - Throw away your USB drive\"\n# >>> item.type\n# story\n# >>> item.kids\n# [ 8952, 9224, 8917, ...]\n```\nTo get item ids of current top stories:\n```python\ntop_story_ids = hn.top_stories()\n# >>> top_story_ids\n# [8432709, 8432616, 8433237, ...]\n```\nTo get current largest item id:\n```python\nmax_item = hn.get_max_item()\n# >>> max_item\n# 8433746\n```\nExamples\n========\n\nGet top 10 stories:\n```python\nfor story_id in hn.top_stories(limit=10):\n print hn.get_item(story_id)\n\n# \n# \n# \n# ...\n# ...\n```\nFind all the 'jobs' post from Top Stories:\n```python\nfor story_id in hn.top_stories():\n story = hn.get_item(story_id)\n if story.item_type == 'job':\n print story\n\n# \n# \n# \n# ...\n# ...\n```\nFind Python jobs from monthly who is hiring thread:\n```python\n# Who is hiring\n# https://news.ycombinator.com/item?id=8394339\n\nwho_is_hiring = hn.get_item(8394339)\n\nfor comment_id in who_is_hiring.kids:\n comment = hn.get_item(comment_id)\n if 'python' in comment.text.lower():\n print comment.item_id\n\n# 8395568\n# 8394964\n# ...\n# ...\n```\nAPI Reference\n=============\n\nClass: `HackerNews`\n===================\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| ---------- | ------ | --------- | ------------------------------------- | --------\n| `version` | string | No | specifies Hacker News API version | `v0`\n\n`get_item`\n----------\n\nDescription: Returns `Item` object\n\n**Parameters:**\n\n \n| Name | Type | Required | Description | Default\n| ---------- | --------- | -------- | ----------------------------------- | -------\n| `item_id` | string/int| Yes | unique item id of Hacker News story, comment etc | None\n \n\n`get_user`\n----------\n\nDescription: Returns `User` object\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| ------------ | -------- | ---------- | ------------------------------- | ---------\n| `user_id` | string | Yes | unique user id of a Hacker News user | None\n \n\n`top_stories`\n-------------\n\nDescription: Returns list of item ids of current top stories\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| --------- | ----- | --------- | ------------------------------------- | --------\n| `limit` | int | No | specifies the number of stories to be returned | None\n\n\n`new_stories`\n-------------\n\nDescription: Returns list of item ids of current new stories\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| --------- | ----- | --------- | ------------------------------------- | --------\n| `limit` | int | No | specifies the number of stories to be returned | None\n \n\n`ask_stories`\n-------------\n\nDescription: Returns list of item ids of latest Ask HN stories\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| --------- | ----- | --------- | ------------------------------------- | --------\n| `limit` | int | No | specifies the number of stories to be returned | None\n\n\n`show_stories`\n-------------\n\nDescription: Returns list of item ids of latest Show HN stories\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| --------- | ----- | --------- | ------------------------------------- | --------\n| `limit` | int | No | specifies the number of stories to be returned | None\n\n\n`job_stories`\n-------------\n\nDescription: Returns list of item ids of latest Job stories\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| --------- | ----- | --------- | ------------------------------------- | --------\n| `limit` | int | No | specifies the number of stories to be returned | None\n\n\n`updates`\n--------------\n\nDescription: Returns list of item ids and user ids that have been changed/updated recently.\n\n\n`get_max_item`\n--------------\n\nDescription: Returns current largest item id\n\nClass: `Item`\n=============\n\nFrom [Official HackerNews\nItem](https://github.com/HackerNews/API/blob/master/README.md#items):\n\n| Property | Description\n| ----------- | ------------------------------------------------------------\n| item_id | The item\u2019s unique id.\n| deleted | `true` if the item is deleted.\n| item_type | The type of item. One of \u201cjob\u201d, \u201cstory\u201d, \u201ccomment\u201d, \u201cpoll\u201d, or \u201cpollopt\u201d.\n| by | The username of the item\u2019s author.\n| submission_time | Creation date of the item, in Python `datetime`.\n| text | The comment, Ask HN, or poll text. HTML.\n| dead | `true` if the item is dead.\n| parent | The item\u2019s parent. For comments, either another comment or the relevant story. For pollopts, the relevant poll.\n| kids | The ids of the item\u2019s comments, in ranked display order.\n| url | The URL of the story.\n| score | The story\u2019s score, or the votes for a pollopt.\n| title | The title of the story or poll.\n| parts | A list of related pollopts, in display order.\n| raw | original JSON response.\n\n\nClass: `User`\n=============\n\nFrom [Official HackerNews\nUser](https://github.com/HackerNews/API/blob/master/README.md#users):\n\n| Property | Description\n| --------- | -------------------------------------------------------------\n| user_id | The user\u2019s unique username. Case-sensitive.\n| delay | Delay in minutes between a comment\u2019s creation and its visibility to other users.\n| created | Creation date of the user, in Python `datetime`.\n| karma | The user\u2019s karma.\n| about | The user\u2019s optional self-description. HTML.\n| submitted | List of the user\u2019s stories, polls and comments.\n| raw | original JSON response.\n\nDevelopment\n===========\n\nFor local development do `pip` installation of `requirements-dev.txt`:\n\n pip install -r requirements-dev.txt\n\nLICENSE\n=======\n\nThe mighty MIT license. Please check `LICENSE` for more details.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/avinassh/haxor/", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "hacker", "package_url": "https://pypi.org/project/hacker/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/hacker/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/avinassh/haxor/" }, "release_url": "https://pypi.org/project/hacker/0.3.1/", "requires_dist": null, "requires_python": null, "summary": "Unofficial Python wrapper for Hacker News API", "version": "0.3.1" }, "last_serial": 2119954, "releases": { "0.3.1": [ { "comment_text": "", "digests": { "md5": "69c51e63f0b12b3db51149734387b986", "sha256": "99dde5752785f0fd496046dd92a7ad07755d3295ffb2c19ace442e61ed443677" }, "downloads": -1, "filename": "hacker-0.3.1.tar.gz", "has_sig": false, "md5_digest": "69c51e63f0b12b3db51149734387b986", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7528, "upload_time": "2016-05-17T14:50:26", "url": "https://files.pythonhosted.org/packages/e6/8d/a7fbb6176d08f6c8d77bf0b97cf2be99d0a9fa4f641da8c093931d24b200/hacker-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "69c51e63f0b12b3db51149734387b986", "sha256": "99dde5752785f0fd496046dd92a7ad07755d3295ffb2c19ace442e61ed443677" }, "downloads": -1, "filename": "hacker-0.3.1.tar.gz", "has_sig": false, "md5_digest": "69c51e63f0b12b3db51149734387b986", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7528, "upload_time": "2016-05-17T14:50:26", "url": "https://files.pythonhosted.org/packages/e6/8d/a7fbb6176d08f6c8d77bf0b97cf2be99d0a9fa4f641da8c093931d24b200/hacker-0.3.1.tar.gz" } ] }