e Google::API::OAuth2::SignedJWT;
use strict;
use warnings;
use HTTP::Request::Common;
use JSON;
use JSON::WebToken;
use constant OAUTH2_TOKEN_ENDPOINT => "https://accounts.google.com/o/oauth2/toke
my $json_response = $self->_get_access_token($args);
# set the access token on the object instance.
$args->{access_token} = $json_response->{access_token};
$args->{token_type} = $json_res
rgs->{sub})) {
$jwt_params->{sub} = $args->{sub};
}
# encode jwt.
my $jwt = JSON::WebToken::encode_jwt($jwt_params, $key_contents, JWT_ALGORITHIM, {
typ => JWT_TYP
});
n '
[% USE JSON ( pretty => 1 ) %]
[% DEFAULT o.size = "50" %]
[% DEFAULT o.field = "type" %]
[% DEFAULT o.fieldv = "syslog" %]
{
"index": "logstash-*",
"body": {
"size": [% o.size.json %],
"que
{ [% o.field.json %]: [% o.fieldv.json %] }
},
[% IF o.host %]
{"query_string": {
"default_field": "host.keyword",
"query": [% aonHost( o.host ).json %]
}
y": [% o.hostx.json %]
}
},
[% END %]
[% IF o.srcx %]
{"query_string": {
"default_field": "logsource.keyword",
"query": [% o.srcx.json %]
}
time_zone => 'local',
);
$dt->set_formatter( $fmt );
return( $dt );
}
sub TO_JSON
{
my $self = shift( @_ );
my $fields = $self->fields;
my $ref = {};
foreach my $m
e string.
=head2 TO_JSON
This method is used so that if the cookie object is part of some data encoded into json, this will convert the cookie data properly to be used by L<JSON>
=head1 SIGNED COOK
e HTTP::Link;
use HTTP::Request;
use HTTP::Server::PSGI;
use Log::Any ();
use LWP::UserAgent;
use JSON;
use MIME::Base64;
use Path::Tiny;
use URI::Escape;
use Plack::Request;
use Plack::Response;
use
shift;
my $cache_dir = $self->get_cache_dir;
my $access = path($cache_dir)->child("access.json");
$access->exists;
}
sub make_clean {
my $self = shift;
my $cache_dir = $self->get_
json");
$openid->remove if $openid->exists;
my $client = path($cache_dir)->child("client.json");
$client->remove if $client->exists;
my $access = path($cache_dir)->child("access.json
a project
L<https://salsa.debian.org/iso-codes-team/iso-codes/>
and then files iso_3166-1.json, iso_3166-2.json
L<Locale::Country>,L<Lingua::EN::AddressParse>,
L<Geo::StreetAddress::US>,L<Geo::Postal
-----
package Locale::SubCountry::World;
use strict;
use warnings;
use locale;
use Exporter;
use JSON;
use Locale::SubCountry::Codes;
#---------------------------------------------------------------
try::Codes package
{
unless ( $Locale::SubCountry::Codes::JSON )
{
die "Could not locate Locale::SubCountry::Codes::JSON variable";
}
# Get all the data from the Locale::SubCo
use strict;
use warnings;
package RTIR::Extension::MISP;
use LWP::UserAgent;
use JSON;
use UUID::Tiny ':std';
our $VERSION = '0.02';
RT->AddStyleSheets('rtir-extension-misp.css');
=head1 NAME
RTI
=> $misp_config->[0]{ApiKeyAuth},
'Accept' => 'application/json',
'Content-Type' => 'application/json',
);
$ua->default_headers( $default_headers );
return $ua;
}
response->status_line());
return 0;
}
my $json;
eval { $json = JSON->new->decode($response->content); };
return $json;
}
sub AddRTIRObjectToMISP {
my $ticket = shift;
:Solid::Auth::Util;
use HTTP::Date;
use File::LibMagic;
use File::Basename;
use MIME::Base64;
use JSON;
use Path::Tiny;
use String::Escape;
use Log::Any::Adapter;
Log::Any::Adapter->set('Log4perl');
t a jwt token\n";
}
my $json = JSON->new->pretty;
$header = JSON::decode_json(MIME::Base64::decode_base64url($header));
$payload = JSON::decode_json(MIME::Base64::decode_base64url($
payload));
printf "Header: %s\n" , $json->encode($header);
printf "Payload: %s\n" , $json->encode($payload);
printf "Signature: (binary data)\n", MIME::Base64::decode_base64url($signature
package RT::IR::ExternalFeeds;
use strict;
use warnings;
use LWP::UserAgent;
use JSON;
sub InitMISP {
my $self = shift;
my $misp_config = RT->Config->Get('ExternalFeeds')->{MISP};
unle
->{misp_feeds}{$name}{ApiKeyAuth},
'Accept' => 'application/json',
'Content-Type' => 'application/json',
);
$ua->default_headers( $default_headers );
my $days_to_f
args = { "searchDatefrom" => $date->ISO };
my $json = encode_json( $args );
my $response = $ua->post($url . '/events/index', Content => $json);
return $self->_parse_misp_feed($response);
< Linux version 5.3.0-64-generic >>.
Benchmark with C<< bencher -m Color::RGB::Util --env-hashes-json '[{"PERL5OPT":"-Iarchive/Color-RGB-Util-0.58/lib"},{"PERL5OPT":"-Iarchive/Color-RGB-Util-0.590/li
=head1 NAME
Locale::SubCountry::Codes - data for Locale::SubCountry in JSON format
=head1 DESCRIPTION
Internal data for the Locale::SubCountry module
NOTE, THIS FILE IS CREATED WITH UTF-8 ENCODING
s://salsa.debian.org/iso-codes-team/iso-codes/-/tree/main/data>
and then files iso_3166-1.json, iso_3166-2.json
=cut
#------------------------------------------------------------------------------
u
warnings;
our $VERSION = '2.07';
package Locale::SubCountry::Codes;
$Locale::SubCountry::Codes::JSON =
q{
{
"3166-1": [
{
"alpha_2": "AW",
"alpha_3": "ABW",
"name": "Aruba",
#pod =cut
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::JSON qw( true false );
use Mojo::Util qw( url_escape );
use Yancy::Util qw( json_validator );
use Sys::Hostname qw( hostname );
# XXX: This
ction => 'get',
format => 'json',
};
}
else {
# per-schema - GET = "list"
return {
action => 'list',
format => 'json',
};
}
}
elsif ( $m
,
format => 'json',
};
}
elsif ( $method eq 'put' ) {
die "'$method' $path needs id_field" if !$id_field;
return {
action => 'set',
format => 'json',
};
}
els
arams);
use Data::Kramerius;
use Error::Pure qw(err);
use Getopt::Std;
use IO::Barf qw(barf);
use JSON::XS;
use LWP::UserAgent;
our $VERSION = 0.02;
# Constructor.
sub new {
my ($class, @params) =
status_line;
}
my $struct_hr = decode_json($stream_res->content);
if (! defined $struct_hr) {
err "Cannot decode content of '$kramerius_streams_url' as JSON.";
}
if (! exists $struct_hr->{'IMG_
erAgent object.
run():
Cannot download '%s'.
Cannot decode content of '%s' as JSON.
Kramerius system for '%s' isn't version 4 of API.
Object with '%s' isn't docum
vent::Discord::Payload;
use AnyEvent::WebSocket::Client;
use Data::Dumper;
use JSON qw(decode_json encode_json);
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Headers;
our $VERSION =
body'});
my $payload;
try {
$payload = AnyEvent::Discord::Payload->from_json($message->{'body'});
} catch {
$self->_debug($_);
return;
};
content) {
return $self->_discord_api('POST', 'channels/' . $channel_id . '/messages', encode_json({content => $content}));
}
method typing($channel_id) {
return AnyEvent->timer(
af
parent 'HTTP::Tiny';
if ($ENV{HTTP_TINY_PLUGINS}) {
require JSON::PP;
__PACKAGE__->set_plugins(@{
JSON::PP::decode_json($ENV{HTTP_TINY_PLUGINS})
});
}
sub new {
my $class =
ashref can be specified to
configure the plugin.
=head1 ENVIRONMENT
=head2 HTTP_TINY_PLUGINS
A JSON-encoded array. If set, will call L</set_plugins> with the decoded value.
=head1 HOMEPAGE
Please
use v5.14;
use Moops;
class AnyEvent::Discord::Payload {
use JSON qw(decode_json encode_json);
our $VERSION = '0.1';
has version => ( is => 'ro', isa => Str, default => $VERSION );
has op =
od from_json($class: Str $json) {
$class->new(decode_json($json));
}
method from_hashref($class: HashRef $ref) {
$class->new($ref);
}
method as_json() {
return encode_json({
ken::Const;
use MToken::Util qw/filesize md5sum/;
use constant {
CONTENT_TYPE_JSON => "application/json",
CONTENT_TYPE_TXT => "text/plain; charset=utf-8",
ROW_NUM
ark") if $ctk->verbosemode();
$self->res->headers->content_type(CONTENT_TYPE_JSON);
return $self->render(json => {
generated => dtf(DATETIME_GMT_FORMAT, time(), 1),
me
->render(json => {
message => "Token not found",
}, status => 404) unless -d $dir;
$self->res->headers->content_type(CONTENT_TYPE_JSON);
return $self->render(json => {
ured representation (so that credentials can
be stored in structured configuration files or using JSON) and
"preparators" that can transform credentials into ready-to-use data for
well known targets.
scheme
and all its attributes as a string table.
Here is for instance how it could end up using JSON:
{"scheme":"plain","name":"system","pass":"manager"}
The same information could be stored in
res->headers->www_authenticate('Basic realm="MToken Strict Zone"');
return $c->render(json => {
message => "Authentication required!",
}, status => 401);
s : Tests {
my $self = shift;
return 'author testing only - possible differences between JSON versions'
unless ( $ENV{AUTHOR_TESTING} );
my $stats = $self->testing_chi_root_class->
my $request = $clinet->req;
Returns Mojo::Message::Request object
=head2 request
my $json = $clinet->request("METHOD", "PATH", ...ATTRIBUTES...);
Send request
=head2 res
my $respon
>>> 200 OK [1.04 KB in 0.0242 seconds (43.1 KB/sec)]
CONTENT_TYPE => "application/json",
PWCACHE_TTL => 300, # 5 min (Time to Live)
};
sub new {
my $class = s
>res->code || "000");
$self->status($tx->res->is_success ? 1 : 0);
$self->error($tx->res->json("/message") || $err->{message} || "Unknown error" )
if $tx->res->is_error && !$self->erro