Sign in to PrePAN

Alchemy::DataNews Query Watson's Alchemy News API with Perl syntax



#!/usr/bin/env perl
use strict;
use warnings;

use Alchemy::DataNews;

my $alchemy = Alchemy::DataNews->new(
    api_key => $API_KEY

my $results = $alchemy->search_news({
    keywords => [
            title => ['Congress', 'FCC'],
            text => 'Net Neutrality'
    timeframe => {
       start => {
           date          => 'now',
           amount_before => '2',
           unit          => 'days'
       end => 'now',


Perl wrapper for Watson's Alchemy Data News API:

The Alchemy Data News API is a very powerful REST API capable of searching news and blog posts for keywords across specified time frames. The API also enriches the articles with various natural language processing techniques that allow the user to perform highly targeted searches.

This module interprets Perl syntax into the REST parameters the API expects.


You should put this under the WebService:: namespace, e.g. WebService::Alchemy::DataNews . looking at the api page, it's not Alchemy DataNews, it's AlchemyData News, so you could probably drop the Data from the name and just use WebService::Alchemy::News
Hi, thanks for the feedback! I'm trying to follow what other SDK's have done already. See the python one here:

Eventually, this will be wrapped up in the WatsonDeveloperCloud namespace when the other modules are written.

As for the DataNews name, I can certainly drop the Data part, but same reason as above, I chose to include it because the other SDKs do. Though it seems I could've used Alchemy::Data::News to be more consistent with the others
don't try to follow the python convention. you're making this for the perl community so try to follow their conventions.

Please sign up to post a review.