mgur::API::Stats;
use Data::Dumper;
use LWP::UserAgent;
use HTTP::Message;
use HTTP::Request;
use JSON::XS;
use URI::Escape;
use Moo;
has client_secret=>(is=>'ro');
has client_id=>(is=>'ro',required
PI::Stats->new();});
sub request {
my ($this,$path,$method,$params) = @_;
$params->{_format}="json";
$this->ua->agent("Imgur::API/0.0,1");
my $auth;
if ($this->access_token) {
$auth="Bearer
cation/json") {
$this->stats->update($response);
my $json = JSON::XS::decode_json($response->decoded_content);
if (!$json->{success}) {
my $e = Imgur::API::Exception->new(code=>$json->{stat
e dir.
This POD also contains examples of schemas.
=head1 EXAMPLES
The examples are written in JSON with Javascript-style comments (C<// comment>).
=head2 Various simple examples
// integer, opt
mages in the gallery. For example the main gallery is https://api.imgur.com/3/gallery/hot/viral/0.json
=back
B<Parameters>
=over 4
=item *
C<sort> I<optional>
viral | top | time | rising (only
package Minion::Backend::Pg91;
use Mojo::Base 'Minion::Backend';
use Mojo::IOLoop;
use Mojo::JSON qw(j);
use Mojo::Pg;
use Sys::Hostname 'hostname';
use Carp 'croak';
use Mojo::Util qw(dumper);
our
, task)
values (?, ?, (now() + (interval '1 second' * ?)), ?, ?, ?, ?)
returning id", { json => $args }, $options->{attempts} // 1,
$options->{delay} // 0, $options->{parents} // [],
now(), status = ? where id = ? returning 1';
return $id if $id && $self->pg->db->query($sql, { json => $options->{status} // {} }, $id)->rows;
$sql = q{insert into minion_workers (id, host, pid,
Graylog::API;
{
$Net::Graylog::API::VERSION = '0.7';
}
use strict;
use warnings;
use Furl;
use JSON;
use Moo;
use URI::Escape::XS qw/uri_escape/;
use Data::Printer;
use namespace::clean;
# -------
headers => [
'Accept' => 'application/json',
'content-type' => 'application/json',
],
timeout => $self->timeout,
);
"url [$method] $url" if ( $ENV{DEBUG} );
my $headers; #= [ 'Content-type' => ['application/json'] ] ;
my $res = $self->_furl->request(
method => uc($method),
url => $ur
#!/usr/bin/env perl
use JSON::XS;
use Template;
use Data::Dumper;
use feature qw(say);
open(FI,"data/endpoints.json");
my $data = JSON::XS::decode_json(join("",<FI>));
my $tt = Template->new();
fore
#!/usr/bin/env perl
use JSON::XS;
use Template;
use Data::Dumper;
use feature qw(say);
open(FI,"data/endpoints.json");
my $data = JSON::XS::decode_json(join("",<FI>));
my $tt = Template->new();
fore
use strict;
use feature qw(say);
use Web::Scraper;
use URI;
use Data::Dumper;
use JSON::XS;
use HTML::TreeBuilder::LibXML;
use LWP::UserAgent;
use HTTP::Message;
use Template;
my $template = Templat
q('$_')} @urlparams_opt),
};
push(@{$api->{$endpoint}},$details);
}
}
my $json = JSON::XS->new->pretty;
say $json->encode($api);
sub get_page {
my ($url) = @_;
my $ua = LWP::UserAgent->new
package CloudCron::TargetInput;
use Moose;
use JSON;
has command => (is => 'ro', isa => 'Str', required => 1);
has env => (is => 'ro', isa => 'HashRef[Str]', required => 0, default => sub { {} })
(is => 'ro', isa => 'Str', required => 0, default => sub { 'shell' });
sub json {
my $self = shift;
return to_json({
command => $self->command,
env => $self->env,
onKey => 'QM6T3KHX');
my $data = $client->listSearches(user => '475425');
=cut
use Moo;
use JSON;
use URI::Escape;
use REST::Client;
use Data::Dumper;
use POSIX qw(strftime);
use Carp;
use Log::
ponse = $self->_zotero_get_request('/itemTypes');
return undef unless $response;
decode_json $response->responseContent;
}
=head2 itemTypes()
Get all item fields. Returns a Perl array.
=c
onse = $self->_zotero_get_request('/itemFields');
return undef unless $response;
decode_json $response->responseContent;
}
=head2 itemTypes($type)
Get all valid fields for an item type. Re
me_type_to_description = (
'application/javascript' => 'Javascript',
'application/json' => 'JSON data',
'application/pdf' => 'PDF document',
'application/xhtml+xml' => 'W
];
run ( command => $cmd, verbose => 0 );
}
if ( -e 'MYMETA.json' ) {
$struct = $self->meta_from_file( 'MYMETA.json' );
}
elsif ( -e 'MYMETA.yml' ) {
$struct = $self->meta_fro
m_file( 'MYMETA.yml' );
}
else {
die "Couldn\'t find a 'MYMETA.yml or MYMETA.json' file, giving up\n";
}
{
my $cmd = [ $^X, 'Build', 'distclean' ];
run( command => $cmd, verbos
package CloudCronCLI::Remove;
use MooseX::App::Command;
use Paws;
use JSON;
use CloudDeploy::Utils;
use CloudCron::AWS::CloudWatch;
command_short_description q(Delete a crontab queue or
TA.json' ) {
$struct = $self->meta_from_file( 'META.json' );
}
elsif ( -e 'META.yml' ) {
$struct = $self->meta_from_file( 'META.yml' );
}
else {
die "There is no 'META.json' n
use strict;
use warnings;
use utf8;
use HTML::Entities qw{encode_entities};
use HTTP::Tiny;
use JSON;
use POSIX qw{:locale_h};
use URI::Escape qw{uri_escape_utf8};
#
# The “my” keyword is on a
_options_ => shift,
_base_ => 'https://translate.yandex.net/api/v1.5/tr.json',
_post_ => undef,
_http_ => HTTP::Tiny->new
};
$self->{_text_} = u
sponse->{content}) {
my $json_respond = JSON->new->utf8->decode($response->{content});
return (wantarray) ? @{ $json_respond->{dirs} } : scalar(@{ $json_respond->{dirs} });
}
}
su
];
run ( command => $cmd, verbose => 0 );
}
if ( -e 'MYMETA.json' ) {
$struct = $self->meta_from_file( 'MYMETA.json' );
}
elsif ( -e 'MYMETA.yml' ) {
$struct = $self->meta_fro
use strict;
use warnings;
use utf8;
use HTML::Entities qw{encode_entities};
use HTTP::Tiny;
use JSON;
use POSIX qw{:locale_h};
use URI::Escape qw{uri_escape_utf8};
my
$VERSION = '0.02';
my %valid_
ult_ui = map { $_ => 1 } qw{ en ru tr };
my %valid_format = map { $_ => 1 } qw{ json xml };
my $default_format = 'json';
my $james_axl_result = sub
{
my $self = shift;
die "You must set API
$self->{_lang_}.'&ui='.$self->{_ui_};
my $response = $self->{_http_}->get($self->{_base_} . '.json' . $query . $post);
die "Invalid API key.\n" if ($response->{status} eq '401');
die "Bloc
se Data::Dumper;
use JSON::XS;
use HTML::TreeBuilder::LibXML;
use LWP::UserAgent;
use HTTP::Message;
use Template;
use Try::Tiny;
my $template = Template->new();
my $json = JSON::XS->new->pretty;
m
ok_down(_tag=>'div',class=>'textbox');
my ($example) = ($content->look_down(_tag=>"div",class=>"json"));
if ($example) {
my $ext = $example->as_text;
$ext=~s/\n//g;
$ext=~s/\s{2,}//g;
$ext=
t=~s/[^'|"](\w+):[^\/]/"$1":/g;
$ext=~s/""/","/g;
try {
$res->{example} = $json->encode($json->decode($ext));
} catch {
$res->{example} = $example->as_text;
};
}
$res->{des
e 'missing access_key' };
has base_url => 'https://api.cloudcheckr.com/api';
has format => 'json';
has _ua => sub { Mojo::UserAgent->new };
sub get {
my ($self, $cb) = (shift, ref $_[-
ojo::CloudCheckr->new(access_key => '...');
say $cc->get(account => 'get_accounts_v2')->result->json('/accounts_and_users/0/account_name');
=head1 DESCRIPTION
A simple interface to the CloudChec
;
$cc = $cc->format($format);
The response format from the CloudCheckr API, defaults to json.
# Set the format to XML
$cc->format('xml');
=head1 METHODS
L<Mojo::CloudCheckr> inherits
#!/usr/bin/env perl
use JSON::XS;
use Template;
use Data::Dumper;
use feature qw(say);
open(FI,"data/models.json");
my $data = JSON::XS::decode_json(join("",<FI>));
my $tt = Template->new();
foreach