Skip to main content

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

**list_autocompletes**

GET /autocompletes

List autocompletes

DefaultApi

**list_coverages**

POST /coverages

List coverages

DefaultApi

**list_histograms**

GET /histograms

List histograms

DefaultApi

**list_related_stories**

POST /related_stories

List related stories

DefaultApi

**list_stories**

GET /stories

List Stories

DefaultApi

**list_time_series**

GET /time_series

List time series

DefaultApi

**list_trends**

GET /trends

List trends

Documentation For Models

Documentation For Authorization

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


Download files

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

Source Distribution

aylien_news_api-0.1.0.tar.gz (35.8 kB view hashes)

Uploaded Source

Supported by

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