{"id":17025965,"url":"https://github.com/mattlisiv/newsapi-python","last_synced_at":"2026-04-13T00:30:20.820Z","repository":{"id":45753677,"uuid":"116615264","full_name":"mattlisiv/newsapi-python","owner":"mattlisiv","description":"A Python Client for News API","archived":false,"fork":false,"pushed_at":"2024-08-16T22:39:21.000Z","size":79,"stargazers_count":392,"open_issues_count":22,"forks_count":133,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-09-19T05:48:53.633Z","etag":null,"topics":["api","library","news","newsapi","newsapi-python","python","python-client","v2"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattlisiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-08T01:46:55.000Z","updated_at":"2024-09-18T17:54:52.000Z","dependencies_parsed_at":"2022-07-30T13:08:06.349Z","dependency_job_id":"81306ed9-343b-4513-8fd3-f9ff4f9c990b","html_url":"https://github.com/mattlisiv/newsapi-python","commit_stats":{"total_commits":52,"total_committers":19,"mean_commits":2.736842105263158,"dds":0.7692307692307692,"last_synced_commit":"98b2755481a3aec5c39bcf2c6bc83d7b2815fc13"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattlisiv%2Fnewsapi-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattlisiv%2Fnewsapi-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattlisiv%2Fnewsapi-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattlisiv%2Fnewsapi-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattlisiv","download_url":"https://codeload.github.com/mattlisiv/newsapi-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219847890,"owners_count":16556345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","library","news","newsapi","newsapi-python","python","python-client","v2"],"created_at":"2024-10-14T07:30:16.499Z","updated_at":"2026-04-13T00:30:20.708Z","avatar_url":"https://github.com/mattlisiv.png","language":"Python","readme":"# newsapi-python\n\nA Python client for the [News API](https://newsapi.org/docs/).\n\n[![License](https://img.shields.io/github/license/mattlisiv/newsapi-python.svg)](https://github.com/mattlisiv/newsapi-python/blob/master/LICENSE.txt)\n[![PyPI](https://img.shields.io/pypi/v/newsapi-python.svg)](https://pypi.org/project/newsapi-python/)\n[![Status](https://img.shields.io/pypi/status/newsapi-python.svg)](https://pypi.org/project/newsapi-python/)\n[![Python](https://img.shields.io/pypi/pyversions/newsapi-python.svg)](https://pypi.org/project/newsapi-python)\n\n## License\n\nProvided under [MIT License](https://github.com/mattlisiv/newsapi-python/blob/master/LICENSE.txt) by Matt Lisivick.\n\n```\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n```\n\n## General\n\nThis is a Python client library for [News API V2](https://newsapi.org/).\nThe functions and methods for this library should mirror the\nendpoints specified by the News API [documentation](https://newsapi.org/docs/endpoints).\n\n## Installation\n\nInstallation for the package can be done via `pip`:\n\n```bash\n$ python -m pip install newsapi-python\n```\n\n## Usage\n\nAfter installation, import the client class into your project:\n\n```python\nfrom newsapi import NewsApiClient\n```\n\nInitialize the client with your API key:\n\n```python\napi = NewsApiClient(api_key='XXXXXXXXXXXXXXXXXXXXXXX')\n```\n\n### Endpoints\n\nAn instance of `NewsApiClient` has three instance methods corresponding to three News API endpoints.\n\n#### Top Headlines\n\nUse `.get_top_headlines()` to pull from the [`/top-headlines`](https://newsapi.org/docs/endpoints/top-headlines) endpoint:\n\n```python\napi.get_top_headlines(sources='bbc-news')\n```\n\n#### Everything\n\nUse `.get_everything()` to pull from the [`/everything`](https://newsapi.org/docs/endpoints/everything) endpoint:\n\n```python\napi.get_everything(q='bitcoin')\n```\n\n#### Sources\n\nUse `.get_sources()` to pull from the [`/sources`](https://newsapi.org/docs/endpoints/sources) endpoint:\n\n```python\napi.get_sources()\n```\n\n## For Windows users printing to _cmd_ or _powershell_\n\nYou will encounter an error if you attempt to print the .json() object to the command line. This is because the '{', '}' curly braces to be printed to the console.\nThis becomes especially annoying if developers wish to get 'under the hood'.\n\nHere is the error:\n\n```\nUnicodeEncodeError: 'charmap' codec can't encode character '\\u2019' in position 1444: character maps to \u003cundefined\u003e\n```\n\nThis can be fixed by:\n    - installing 'win-unicode-console'\n        `py -mpip install win-unicode-console`\n    - then running it while calling your python script...\n        `py -mrun myPythonScript.py`\n\nAnother option is hardcoding your console to only print in utf-8. This is a bad idea, as it could ruin many other scripts and/or make errors MUCH more difficult to track.\n[More information](https://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console/32176732#32176732).\n\n\n## Support\n\nFeel free to make suggestions or provide feedback regarding the library. Thanks.\nReach out at [lisivickmatt@gmail.com]('mailto:lisivickmatt@gmail.com')\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattlisiv%2Fnewsapi-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattlisiv%2Fnewsapi-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattlisiv%2Fnewsapi-python/lists"}