DNS 0.06 qw( ERR_NO_HOST ERR_NO_ADDRESS ); # Future return with failure details
use JSON qw( encode_json decode_json );
use URI;
use Socket qw( getnameinfo NI_NUMERICHOST SOCK_RAW );
use constant DE
ef $params{content} ) {
$req->content( encode_json( delete $params{content} ) );
$req->header( Content_type => "application/json" );
}
else {
$req->content( dele
);
}
=head2 request_json
( $body, $response ) = $client->request_json( ... )
A small wrapper around C<request> that decodes the returned body as JSON.
=cut
sub request_json
{
my $self = shi
>
=back
=head1 AUTHOR
Maxim Motylkov
=head1 TODO
The closest plans are
=over 4
=item * Add json data format.
=back
=head1 MODIFICATION HISTORY
See the Changes file.
=head1 COPYRIGHT AND LIC
-key => $SALT,
-cipher => 'Blowfish'
);
return $cipher->encrypt(to_json($session));
}
sub _password_hash {
my ($self, $key, $password) = @_;
utf8::encode($key)
-key => $SALT,
-cipher => 'Blowfish'
);
try {
$session = from_json($cipher->decrypt($session));
}
catch {
throw Exception::Authorization::BadSession
$msg = $msg->[0] if ref $msg eq 'ARRAY' && @$msg == 1;
if (eval { $msg->isa('Log::Message::JSON') }) {
$msg = { %$msg };
} elsif (eval { $msg->DOES("Log::Message::Structured") }) {
$m
ort = 5044
log4perl.appender.Remote.keepalive = 0
log4perl.appender.Remote.frame_format = json
#log4perl.appender.Remote.use_ssl = 1
#log4perl.appender.Remote.ssl_verify = 1
# thes
f frames per connection.
=head2 frame_formt (default: 'json')
The following frame formats are supported:
=over
=item 'json', 'v2'
Uses json formatted data frames as defined in lumberjack protocol
ge returns and line feeds to spaces before passing the
string to the parser.
Neither YAML nor JSON can be handled.
Internally, XML::Lenient uses lots of regexes (and other things as
well. I kn
attermost APIs
=cut
use AnyEvent;
use AnyEvent::WebSocket::Client 0.37;
use Carp;
use Furl;
use JSON;
use Time::HiRes qw( time );
use Try::Tiny;
=head1 SYNOPSIS
use AnyEvent;
use AnyEvent:
}
}
sub _handle_incoming {
my ($self, $conn, $raw) = @_;
my $msg = try {
decode_json($raw->body);
}
catch {
my $message = $raw->body;
croak "unable to decode
$res = $furl->get($self->{'host'} . $path, $self->_headers);
my $data = try {
decode_json($res->content);
} catch {
my $status = $res->status;
my $message = $res->cont
> undef,
onSuccess => undef,
onError => undef,
onStart => undef,
__format=>'json',
buffer=>'',
);
sub start{
my ($self) = @_;
$self->{buffer} = ''; # truncate the
n/json
if($response->content_type eq 'application/json'){
use Encode;
$content = Encode::decode('UTF-8', $content);
}
if($self->__format eq 'json'){
return JSON->
;
use strict;
use Eixo::Base::Clase;
use URI;
use LWP::UserAgent;
use LWP::Protocol::https;
use JSON -convert_blessed_universally;
use Carp;
use Data::Dumper;
use Config;
use Eixo::Rest::RequestSyn
my $USER_AGENT_VERSION = 'EixoAgent/0.1';
has(
ua=>undef,
endpoint=>undef,
format=>'json',
error_callback => undef,
current_method => undef,
);
sub initialize{
my ($self, $e
tent-Type')
|| 'application/json';
#|| 'application/x-www-form-urlencoded';
if($content_type eq "application/json"){
$content = JSON->new->allow_blessed(1)
filename);
use Test::RestAPI::MojoGenerator;
use Port::Selector;
use Path::Tiny;
use Mojo::JSON qw(decode_json);
use Mojo::UserAgent;
use constant WINDOWS => ($^O eq 'MSWin32');
BEGIN {
if (WIND
my @lines;
while (my $line = <$fh>) {
chomp $line;
push @lines, decode_json($line);
}
return \@lines;
}
sub DESTROY {
my ($self) = @_;
if ($^O eq 'MSWin3
F', $endpoints));
% my ($endpoints) = @_;
use Mojolicious::Lite;
use Path::Tiny;
use Mojo::JSON qw(encode_json);
% foreach my $endpoint (@$endpoints) {
<%= $endpoint->method %> '<%= $endpoint->path %
b {
my ($c) = @_;
path(app->home(), "<%= $endpoint->path_as_filename %>")->append(encode_json($c->req->body)."\n");
$c->render(%{<%= $endpoint->render_as_string %>});
};
% }
any '/app_m
package Eixo::Rest::RequestAsync;
use strict;
use threads;
use Thread::Queue;
use JSON -convert_blessed_universally;
# use Eixo::Base::Clase;
use Eixo::Base::Clase 'Eixo::Rest::Request';
use Attr
package Eixo::Rest;
use 5.008;
use strict;
use warnings;
use parent qw(Eixo::Base::Clase);
use JSON;
use LWP::UserAgent;
our $VERSION = '1.207';
1;
ute) = @_;
return undef if(grep {$attribute eq $_} $self->NOT_SERIALIZE);
return 1;
}
sub TO_JSON {
my $self = $_[0];
return {map {$_ => $self->$_} grep {$self->is_serializable($_)} keys(%$sel
Plack::Middleware::HTTPExceptions;
use Plack::Middleware::Access;
use Carp qw(croak);
use JSON qw(decode_json);
use Scalar::Util qw(blessed);
our $VERSION = '0.9';
our @GITHUB_IPS = (
allow =>
) {
$payload = $req->param('payload') || $req->content;
$payload = eval { decode_json $payload };
}
if (!$payload) {
return [400,['Content-Type'=>'text/plain','Conten
ION
This L<PSGI> application receives HTTP POST requests with body parameter
C<payload> set to a JSON object. The default use case is to receive
L<GitHub WebHooks|http://developer.github.com/webhook
uth2;
use Moo;
use Method::Signatures;
use IO::File;
use LWP::UserAgent;
use URI::QueryParam;
use JSON;
use MIME::Base64;
use Data::Dumper;
our $VERSION = '1.002';
has 'client_id' => ( is => 'rw
if (my $fh = IO::File->new('< ' . $self->cache_path)) {
local $/;
$token_info = from_json( <$fh> );
$fh->close;
}
$token_info = $self->refresh_access_token($token_info->{re
IO::File->new('> ' . $self->cache_path) || die "Could not create cache file $@";
print $fh to_json($token_info);
$fh->close;
}
}
method is_token_expired ($token_info) {
return ($token_inf
ebService::Spotify;
use Moo;
use Method::Signatures;
use LWP::UserAgent;
use URI::QueryParam;
use JSON;
use Data::Dumper;
our $VERSION = '1.003';
has 'prefix' => ( is => 'rw', default => 'https://ap
$uri->as_string);
$self->_log("RESP", $response->content);
return $response->content ? from_json($response->content) : undef;
}
method post ($method, $payload, %args) {
my $uri = $self->
headers;
$headers->{'Content-Type'} = 'application/json';
my $response = $self->user_agent->post( $uri->as_string, %$headers, Content => to_json($payload) );
$self->_log("POST", $uri->as_stri
ackage WebService::Slack::IncomingWebHook;
use 5.008001;
use strict;
use warnings;
use utf8;
use JSON;
use Furl;
use Carp ();
our $VERSION = "0.02";
sub new {
my ($class, %args) = @_;
Carp:
{$_} ) } qw( webhook_url channel icon_emoji icon_url username )
} => $class;
$self->{json} = JSON->new->utf8;
$self->{furl} = Furl->new(agent => "$class.$VERSION");
return $self;
}
->{furl}->post(
$self->{webhook_url},
['Content-Type' => 'application/json'],
$self->{json}->encode($post_data),
);
if (! $res->is_success) {
Carp::carp('post f
led?
use lib "$FindBin::Bin"; # use that dir for libs, too
use strict;
use warnings;
use JSON;
use FAIR::Accessor::Distribution;
use FAIR::Accessor::Container;
use FAIR::Accessor::MetaReco
package Plift::Context;
use Moo;
use Carp;
use XML::LibXML::jQuery;
use JSON 'to_json';
use Encode 'encode';
use namespace::clean;
use Ref::Util qw/ is_hashref is_blessed_ref /;
has 'helper', is =>
ion);
$target_element->remove unless defined $value;
# to_json
$value = to_json($value, { convert_blessed => 1 }) if ref $value eq 'HASH';
# encode
:VERSION = '1.001';
# ABSTRACT: The core Accessor functions
use Moose;
use URI::Escape;
use JSON;
use FAIR::AccessorConfig;
use RDF::Trine::Parser 0.135;
use RDF::Trine::Model 0.135;
use RDF::Tr