Skip to main content

A python wrapper for thenewsapi.com

Project description

python-thenewsapi

A python wrapper for https://thenewsapi.com

All params from their website are supported in the functions

Top Stories

import thenewsapi

tna = thenewsapi.TheNewsAPIClient('API_KEY')
    
top_stories = tna.get_top_stories()
    
print(top_stories)

All News

import thenewsapi

tna = thenewsapi.TheNewsAPIClient(API_KEY)
    
all_news = tna.get_all_news()
    
print(all_news)

Similar News

import thenewsapi

tna = thenewsapi.TheNewsAPIClient(API_KEY)
    
similar_news = tna.get_similar_news(NEWS_UUID)
    
print(similar_news)

News By UUID

import thenewsapi

tna = thenewsapi.TheNewsAPIClient(API_KEY)
    
news_by_uuid = tna.get_news_by_uuid(NEWS_UUID)
    
print(news_by_uuid)

Sources

import thenewsapi

tna = thenewsapi.TheNewsAPIClient(API_KEY)
    
sources = tna.get_sources()
    
print(sources)

Headlines (Standard+ tier needed)

import thenewsapi

tna = thenewsapi.TheNewsAPIClient(API_KEY)
    
headlines = tna.get_headlines()
    
print(headlines)

If you want to use multiple values for one param, I suggest you use lists to make it more relateable, like:

tna.get_top_stories(locale=['ae','ar'])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-thenewsapi-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file python-thenewsapi-0.1.1.tar.gz.

File metadata

  • Download URL: python-thenewsapi-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for python-thenewsapi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3940ae1064cbdc435d5b012bc5efadeada47b66932f2faa91878ad08035f4647
MD5 68529807c70c875dfbc267e9141612bf
BLAKE2b-256 31651ee54e080a8729565d6b43721817886ef7a5c88cd77bfff9515edae4d72e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page