{ "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 :: 3.6", "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\n### Import and initialization:\n```python\nfrom hackernews import HackerNews\nhn = HackerNews()\n```\n\n### Items\nStories, comments, jobs, Ask HNs and even polls are just items with unique item id.\n\nTo query item information by id:\n```python\nitem = hn.get_item(8863)\n# >>> item.title\n# 'My YC app: Dropbox - Throw away your USB drive'\n# >>> item.item_type\n# 'story'\n# >>> item.kids\n# [ 8952, 9224, 8917, ...]\n```\nSince most results are returned as integer IDs (like item.kids above), these results require further iteration. Instead of doing this yourself, use the `expand` flag to get object-oriented, detailed item info by id:\n```python\nitem = hn.get_item(8863, expand=True)\n# >>> item.kids\n# [, , ...]\n# >>> item.by\n# \n```\n\nTo query a list of Item IDs:\n```python\nitems = hn.get_items_by_ids([8863, 37236, 2345])\n# >>> items\n# [, , ]\n```\nUse the `item_type` filter to specifically select 'story', 'comment', 'job', or 'poll' items:\n```python\nitems = hn.get_items_by_ids([8863, 37236, 2345], item_type='story')\n# >>> items\n# [, ]\n```\n\n#### Stories\nThe HN API allows for real-time querying for New, Top, Best, Ask HN, Show HN, and Jobs stories.\n\nAs an example, to get Item objects of current top stories:\n```python\ntop_stories = hn.top_stories()\n# >>> top_stories\n# [, ...]\n```\n\n#### Useful Item Queries\n\nTo get current largest Item id (most recent story, comment, job, or poll):\n```python\nmax_item = hn.get_max_item()\n# >>> max_item\n# 16925673\n```\nOnce again, use the `expand` flag to get an object-oriented, detailed Item representation:\n```python\nmax_item = hn.get_max_item(expand=True)\n# >>> max_item\n# \n```\n\nTo get the x most recent Items:\n```python\nlast_ten = hn.get_last(10)\n# >>> last_ten\n# [, ...]\n```\n\n### Users\nHN users are also queryable.\n\nTo query users 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```\nUse the `expand` flag to get an object-oriented, detailed Item representation for User attributes:\n```python\nuser = hn.get_user('dhouston', expand=True)\n# >>> user.stories\n# [, ...]\n# >>> user.comments\n# [, , ...]\n# >>> user.jobs\n# [, ...]\n```\n\nTo query a list of users:\n```python\nusers = hn.get_users_by_ids(['pg','dhouston'])\n# >>> users\n# [, ]\n```\n\nExamples\n========\n\nGet top 10 stories:\n```python\nhn.top_stories(limit=10)\n\n# [, , ...]\n```\n\nFind all the 'jobs' post from Top Stories:\n```python\nstories = hn.top_stories()\nfor story in stories:\n if story.item_type == 'job':\n print(story)\n\n# \n# ...\n# ...\n```\n\nFind Python jobs from monthly who is hiring thread:\n```python\n# Who is hiring - April 2018\n# https://news.ycombinator.com/item?id=16735011\n\nwho_is_hiring = hn.get_item(16735011, expand=True)\n\nfor comment in who_is_hiring.kids:\n if 'python' in comment.text.lower():\n print(comment)\n\n# \n# \n# ...\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| `expand` | bool | No | flag to indicate whether to transform all IDs into objects | False\n\n`get_items_by_ids`\n----------\n\nDescription: Returns list of `Item` objects\n\n**Parameters:**\n\n\n| Name | Type | Required | Description | Default\n| ---------- | --------- | -------- | ----------------------------------- | -------\n| `item_ids` | list of string/int | Yes | unique item ids of Hacker News stories, comments etc | None\n| `item_type` | string | No | item type to filter results with | None\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| `expand` | bool | No | flag to indicate whether to transform all IDs into objects | False\n\n`get_users_by_ids`\n----------\n\nDescription: Returns list of `User` objects\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| ------------ | -------- | ---------- | ------------------------------- | ---------\n| `user_ids` | list of string/int | Yes | unique user ids of Hacker News users | None\n\n\n`top_stories`\n-------------\n\nDescription: Returns list of `Item` objects of current top stories\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| --------- | ----- | --------- | ------------------------------------- | --------\n| `raw` | bool | No | indicate whether to represent all objects in raw json | False\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` objects of current new stories\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| --------- | ----- | --------- | ------------------------------------- | --------\n| `raw` | bool | No | indicate whether to represent all objects in raw json | False\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` objects of latest Ask HN stories\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| --------- | ----- | --------- | ------------------------------------- | --------\n| `raw` | bool | No | indicate whether to represent all objects in raw json | False\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` objects of latest Show HN stories\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| --------- | ----- | --------- | ------------------------------------- | --------\n| `raw` | bool | No | indicate whether to represent all objects in raw json | False\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` objects of latest Job stories\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| --------- | ----- | --------- | ------------------------------------- | --------\n| `raw` | bool | No | indicate whether to represent all objects in raw json | False\n| `limit` | int | No | specifies the number of stories to be returned | None\n\n\n`updates`\n--------------\n\nDescription: Returns list of `Item` and `User` objects that have been changed/updated recently.\n\n**Parameters:**\nN/A\n\n`get_max_item`\n--------------\n\nDescription: Returns current largest item id or current largest `Item` object\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| ------------ | -------- | ---------- | ------------------------------- | ---------\n| `expand` | bool | No | flag to indicate whether to transform ID into object | False\n\n`get_all`\n--------------\n\nDescription: Returns all `Item` objects from HN\n\n**Parameters:**\nN/A\n\n`get_last`\n--------------\n\nDescription: Returns list of `num` most recent `Item` objects\n\n**Parameters:**\n\n| Name | Type | Required | Description | Default\n| ------------ | -------- | ---------- | ------------------------------- | ---------\n| `num` | int | No | numbr of most recent records to pull from HN | 10\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| poll | The ids of poll's.\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| descendants | In the case of stories or polls, the total comment count.\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\nAdditional properties when `expand` is used\n\n| Property | Description\n| ----------- | ------------------------------------------------------------\n| stories | The user\u2019s submitted stories.\n| comments | The user's submitted comments.\n| jobs | The user's submitted jobs.\n| polls | The user's submitted polls.\n| pollopts | The user's submitted poll options.\n\nDevelopment\n===========\n\nFor local development do `pip` installation of `requirements-dev.txt`:\n\n pip install -r requirements-dev.txt\n\nTesting\n=======\n\nRun the test suite by running:\n\n python setup.py develop\n pytest tests\n\nLICENSE\n=======\n\nThe mighty MIT license. Please check `LICENSE` for more details.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/avinassh/haxor/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "haxor", "package_url": "https://pypi.org/project/haxor/", "platform": "", "project_url": "https://pypi.org/project/haxor/", "project_urls": { "Homepage": "https://github.com/avinassh/haxor/" }, "release_url": "https://pypi.org/project/haxor/1.2.1/", "requires_dist": null, "requires_python": "", "summary": "Unofficial Python wrapper for Hacker News API", "version": "1.2.1" }, "last_serial": 3921588, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "788cb72bccf19931403eb5eecab95562", "sha256": "3257e5d4d8d537599aea13187429d350decb81be97d3fd47d93e5e06263becea" }, "downloads": -1, "filename": "haxor-0.1.0.tar.gz", "has_sig": false, "md5_digest": "788cb72bccf19931403eb5eecab95562", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6650, "upload_time": "2014-10-09T17:59:44", "url": "https://files.pythonhosted.org/packages/45/5c/0a3723545c7212c666ae958d293ea86e31a0acf99420b6edcd1975c82686/haxor-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a9f4d81d37b973e6379b89f4cfc66ad8", "sha256": "577688adfd3a8ea9d861f73f2a7d9b69a1f663022b4ea2d464e5c70764dc7a5f" }, "downloads": -1, "filename": "haxor-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a9f4d81d37b973e6379b89f4cfc66ad8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6700, "upload_time": "2014-10-10T11:25:13", "url": "https://files.pythonhosted.org/packages/66/78/95dac1598a22a89f2705f7c63bd234884e382edd8c3ff8a4f2ed7220a936/haxor-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "3c5c76520b011a850539f2e7988b6aff", "sha256": "97b48007bdb2f015dc26ec3f401ffa5d11d9b3e90ceb23bb6c7aacb01f3292b9" }, "downloads": -1, "filename": "haxor-0.2.0.tar.gz", "has_sig": false, "md5_digest": "3c5c76520b011a850539f2e7988b6aff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6770, "upload_time": "2014-10-10T14:15:56", "url": "https://files.pythonhosted.org/packages/53/4c/143a8358a6b2b35b0c06db3476b2e6bc7b9b2743f3130ad71ff5ab9cc721/haxor-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "c3705f37b6b6f142ca84e42a0d45ed6f", "sha256": "475a6dc6cddc5a9d9f9773df980d6bc328e271d249427e37f38e8d36710d8e0f" }, "downloads": -1, "filename": "haxor-0.2.1.tar.gz", "has_sig": false, "md5_digest": "c3705f37b6b6f142ca84e42a0d45ed6f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7158, "upload_time": "2014-10-10T15:31:59", "url": "https://files.pythonhosted.org/packages/63/9a/a362136f025f81f4288c26c452b6d4e704d2aed8dccae9bd23a74732de33/haxor-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "15b5ae35e21e40e73a8cff2cdf2b6d9f", "sha256": "09aa09ae3eb8c219ae76c0db74f07f88b69bbd812e4f2e45ad0ce8acbec46608" }, "downloads": -1, "filename": "haxor-0.2.2.tar.gz", "has_sig": false, "md5_digest": "15b5ae35e21e40e73a8cff2cdf2b6d9f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7320, "upload_time": "2014-10-10T16:49:29", "url": "https://files.pythonhosted.org/packages/f6/09/a687150ad595629c9738e9d177a34cd331046d480b8f99c7475254f72052/haxor-0.2.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "b80ab2b2419b86c85b6bb25c8065a001", "sha256": "fb1d8268b74b821cac1b58f8de9cd7bc511a67d79e44995018b4a5d2dcaa0267" }, "downloads": -1, "filename": "haxor-0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "b80ab2b2419b86c85b6bb25c8065a001", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13841, "upload_time": "2015-07-02T17:41:12", "url": "https://files.pythonhosted.org/packages/8d/0a/30a5301fc3329da78a936679fe3d0d7dfcbaeda3c07daae8cfadabb81a14/haxor-0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0952583fa4249736bc92ffd32b0421d4", "sha256": "386b831ef0252ba2bc6708e71d35e8254659f2b74725bb43c279d975840d13e3" }, "downloads": -1, "filename": "haxor-0.3.tar.gz", "has_sig": false, "md5_digest": "0952583fa4249736bc92ffd32b0421d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7222, "upload_time": "2015-07-02T17:41:05", "url": "https://files.pythonhosted.org/packages/12/7f/ca8cdb9d87b2ddabeb4ff523bbef1f838fa0e6556c9e4fe8ebbf4cee8676/haxor-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "64604f97483850c9e01a116f6ce33fbc", "sha256": "d174c05fb9056f761f9b34c3f33a7d1e2197b2bff7e6ad7c90e147a2fdee61ea" }, "downloads": -1, "filename": "haxor-0.3.1-py2-none-any.whl", "has_sig": false, "md5_digest": "64604f97483850c9e01a116f6ce33fbc", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 25461, "upload_time": "2015-11-24T11:40:50", "url": "https://files.pythonhosted.org/packages/11/5a/a751fcb8bc7be037a79538986411bb1e2e60433b3e465f581d244984b00f/haxor-0.3.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "291b679fc95d14d75cfd08f0818c024d", "sha256": "86eb3ec5006c0a665e5557013eed742e65c3219ffd82cc7cee76aed8dcddf485" }, "downloads": -1, "filename": "haxor-0.3.1.tar.gz", "has_sig": false, "md5_digest": "291b679fc95d14d75cfd08f0818c024d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7625, "upload_time": "2015-11-24T11:40:43", "url": "https://files.pythonhosted.org/packages/61/68/f89bd89e69bc02daddc84bc04709cafc788d2bd8510a9c23d771e37f211e/haxor-0.3.1.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "9d89222da39f1039763534fb70674b1c", "sha256": "dc0ab600f5026065b119d809d9bdcab8f0ee0b48401d445d26af76906b2ef205" }, "downloads": -1, "filename": "haxor-0.4.tar.gz", "has_sig": false, "md5_digest": "9d89222da39f1039763534fb70674b1c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8276, "upload_time": "2017-04-21T16:31:27", "url": "https://files.pythonhosted.org/packages/78/83/701b7cd22763f3517fd4b231861edf3263e5ed6d2c3901dda239a69e987b/haxor-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "087987b30811e88dfd9f8bfd05dc863b", "sha256": "7757e8c4a354c95c60a841638abc1b85e379d90eda99020e026de21ecc9d944c" }, "downloads": -1, "filename": "haxor-0.5.tar.gz", "has_sig": false, "md5_digest": "087987b30811e88dfd9f8bfd05dc863b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8304, "upload_time": "2017-09-09T06:05:52", "url": "https://files.pythonhosted.org/packages/97/bd/32fc350db511d1bccbdffcee454720cf69b9a928ca451da66cf5287d69f1/haxor-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "340909daa8789f66bfdf20ec0a002365", "sha256": "5e2d8dfe4d579738bbb8e3eac933fcdbea86edf2db17f7c8e9bcf3048561709a" }, "downloads": -1, "filename": "haxor-0.6.tar.gz", "has_sig": false, "md5_digest": "340909daa8789f66bfdf20ec0a002365", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7736, "upload_time": "2017-11-14T11:55:05", "url": "https://files.pythonhosted.org/packages/e4/0f/8feae04a3940cd2d6ffd3cb8dcc488fe9fb09b7621c7cd45b1742ecc35e1/haxor-0.6.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "1a84d450723216ac15cf14a3e692ef04", "sha256": "4b2f748c5e37fa4f8a093633280d1c29b26d714b889a30668c1f9c4290a13435" }, "downloads": -1, "filename": "haxor-1.1.tar.gz", "has_sig": false, "md5_digest": "1a84d450723216ac15cf14a3e692ef04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16470, "upload_time": "2018-05-13T12:17:35", "url": "https://files.pythonhosted.org/packages/0e/2e/086a8725deaae6bb4522275b54806bebdc0a5fe3d91f500e0960b0e7bcd2/haxor-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "a500776649d03c70fc9eba0d7be0b1db", "sha256": "cd51dd8c934cc855236a79b929083e422a9a5f4951b5c3161d9fdc45ab5c67a1" }, "downloads": -1, "filename": "haxor-1.2.tar.gz", "has_sig": false, "md5_digest": "a500776649d03c70fc9eba0d7be0b1db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16349, "upload_time": "2018-06-01T11:42:02", "url": "https://files.pythonhosted.org/packages/4f/42/40d509d42d6b704a31c2a8a5fc56efbbe0507d72a229883286cd1ef0955c/haxor-1.2.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "0129ff2dd6a56048e2cc2801da7bca98", "sha256": "a4341c3f4beb5ba797767af902378b24052bbb6be9e77552b7a9e56ec2002d5e" }, "downloads": -1, "filename": "haxor-1.2.1.tar.gz", "has_sig": false, "md5_digest": "0129ff2dd6a56048e2cc2801da7bca98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16373, "upload_time": "2018-06-01T17:23:18", "url": "https://files.pythonhosted.org/packages/c4/6b/9be506af1ceb0b22212f3d3e693386434eaf60df54f2e74094f9c07178e1/haxor-1.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0129ff2dd6a56048e2cc2801da7bca98", "sha256": "a4341c3f4beb5ba797767af902378b24052bbb6be9e77552b7a9e56ec2002d5e" }, "downloads": -1, "filename": "haxor-1.2.1.tar.gz", "has_sig": false, "md5_digest": "0129ff2dd6a56048e2cc2801da7bca98", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16373, "upload_time": "2018-06-01T17:23:18", "url": "https://files.pythonhosted.org/packages/c4/6b/9be506af1ceb0b22212f3d3e693386434eaf60df54f2e74094f9c07178e1/haxor-1.2.1.tar.gz" } ] }