AYLIEN News API Client Library for Python
Project description
AYLIEN News API is the most powerful way of sourcing, searching and syndicating analyzed and enriched news content. If you haven’t already done so, you will need to sign up.
Visit our interactive documentation to familiarize yourself with the API.
Requirements.
Python 2.7 and 3.4+
Installation & Usage
PyPI
Install it directly from PyPI repository:
pip install aylien_news_api
(or sudo pip install aylien_news_api to install the package for all users)
Git
Install it via:
pip install git+https://github.com/AYLIEN/aylien_newsapi_python.git
(you may need to run pip with root permission: sudo pip install git+https://github.com/AYLIEN/aylien_newsapi_python.git)
Then import the package:
import aylien_news_api
Getting Started
Please follow the installation procedure and then run the following:
import aylien_news_api
from aylien_news_api.rest import ApiException
# Configure API key authorization: app_id
aylien_news_api.configuration.api_key['X-AYLIEN-NewsAPI-Application-ID'] = 'YOUR_APP_ID'
# Configure API key authorization: app_key
aylien_news_api.configuration.api_key['X-AYLIEN-NewsAPI-Application-Key'] = 'YOUR_APP_KEY'
# create an instance of the API class
api_instance = aylien_news_api.DefaultApi()
title = 'trump'
sort_by = 'social_shares_count.facebook'
language = ['en']
since = 'NOW-7DAYS'
until = 'NOW'
entities = [
'http://dbpedia.org/resource/Donald_Trump',
'http://dbpedia.org/resource/Hillary_Rodham_Clinton'
]
try:
# List stories
api_response = api_instance.list_stories(title=title, language=language, published_at_start=since, published_at_end=until, entities_body_links_dbpedia=entities, sort_by=sort_by)
print(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->list_stories: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to *https://api.newsapi.aylien.com/api/v1*
Class |
Method |
HTTP request |
Description |
---|---|---|---|
DefaultApi |
GET /autocompletes |
List autocompletes |
|
DefaultApi |
POST /coverages |
List coverages |
|
DefaultApi |
GET /histograms |
List histograms |
|
DefaultApi |
POST /related_stories |
List related stories |
|
DefaultApi |
GET /stories |
List Stories |
|
DefaultApi |
GET /time_series |
List time series |
|
DefaultApi |
GET /trends |
List trends |
Documentation For Models
app_id
Type: API key
API key parameter name: X-AYLIEN-NewsAPI-Application-ID
Location: HTTP header
app_key
Type: API key
API key parameter name: X-AYLIEN-NewsAPI-Application-Key
Location: HTTP header
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.