view release on metacpan or search on metacpan
lib/AnyEvent/Consul.pm view on Meta::CPAN
AnyEvent::Consul is a thin wrapper around L<Consul> to connect it to
L<AnyEvent::HTTP> for asynchronous operation.
It takes the same arguments and methods as L<Consul> itself, so see the
documentation for that module for details. The important difference is that you
must pass the C<cb> option to the endpoint methods to enable their asynchronous
mode.
There's also a C<on_error> argument. If you pass in a coderef for this
argument, it will be called with a single string arg whenever something goes
wrong internally (usually a HTTP failure). Use it to safely log or cleanup
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Discord/Client.pm view on Meta::CPAN
},
);
=item C<api(I<$method>, I<$path>, I<$data>, I<$cb>)>
Invokes the Discord API asynchronously and returns immediately. C<$method> is the HTTP method to use; C<$path> is the endpoint to call. If C<$data> is a reference, it is sent as JSON; otherwise, if it is defined, it is sent as a C<x-www-form-urlenc...
=item C<api_sync(I<$method>, I<$path>, I<$data>)>
Invokes the Discord API synchronously and returns the result of the call. C<$method> is the HTTP method to use; C<$path> is the endpoint to call. If C<$data> is a reference, it is sent as JSON; otherwise, if it is defined, it is sent as a C<x-www-f...
=item C<websocket_send(I<$op>, I<$d>)>
Sends a raw WebSocket payload as per the L<Discord Gateway|https://discordapp.com/developers/docs/topics/gateway> documentation.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Discord.pm view on Meta::CPAN
my $msg = $payload->as_json;
$self->_trace('ws out: ' . $msg);
$self->_socket->send($msg);
}
# Look up the gateway endpoint using the Discord API
method _lookup_gateway() {
my $payload = $self->_discord_api('GET', 'gateway');
die 'Invalid gateway returned by API' unless ($payload and $payload->{url} and $payload->{url} =~ /^wss/);
# Add the requested version and encoding to the provided URL
lib/AnyEvent/Discord.pm view on Meta::CPAN
=item connect()
Start connecting to the Discord API and return immediately. In a new AnyEvent
application, this would come before executing "AnyEvent->condvar->recv". This
method will retrieve the available gateway endpoint, create a connection,
identify itself, begin a heartbeat, and once complete, Discord will fire a
'ready' event to the handler.
=item send($channel_id, $content)
view all matches for this distribution
view release on metacpan or search on metacpan
0.04 Mon Oct 26 13:59:15 PDT 2009
- Fixed POD errors
- Reconnect when a long poll times out with an empty event (kappa)
0.03 Mon Jul 20 11:34:12 PDT 2009
- Updated API and endpoint to v2. 'method' should now be 'request'.
- entry data structure has changed and is incompatible.
0.02 Thu Jul 16 20:09:55 PDT 2009
- Remove debug bits
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/JSONRPC/HTTP/Client.pm view on Meta::CPAN
=over 4
=item url => 'Str'
URL to json-RPC endpoint to connect. (Required)
=item username => 'Str'
Username to use for authorization (Optional).
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Lingr.pm view on Meta::CPAN
has 'api_key' => (
is => 'ro',
);
has 'endpoint' => (
is => 'ro',
default => 'http://lingr.com/api/',
);
has 'session' => (
lib/AnyEvent/Lingr.pm view on Meta::CPAN
no Mouse;
sub request {
my ($self, $http_method, $method, $params, $cb) = @_;
my $uri = URI->new($self->endpoint . $method);
$uri->query_form($params);
my $cb_wrap = sub {
my ($body, $hdr) = @_;
lib/AnyEvent/Lingr.pm view on Meta::CPAN
if ($self->_polling_guard) {
debugf 'polling session is still active, ignoring this request';
return;
}
my $uri = URI->new( $self->endpoint . 'event/observe' );
$uri->port(8080);
$uri->query_form({ session => $self->session, counter => $self->counter });
my $guard = http_get $uri, timeout => 60, sub {
my ($body, $hdr) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
=item binds - C<ip:port>
Nodes can only talk to each other by creating some kind of connection to
each other. To do this, nodes should listen on one or more local transport
endpoints - binds.
Currently, only standard C<ip:port> specifications can be used, which
specify TCP ports to listen on. So a bind is basically just a tcp socket
in listening mode that accepts connections from other nodes.
Seed nodes are represented by seed IDs.
=item seed IDs - C<host:port>
Seed IDs are transport endpoint(s) (usually a hostname/IP address and a
TCP port) of nodes that should be used as seed nodes.
=item global nodes
An AEMP network needs a discovery service - nodes need to know how to
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Mattermost.pm view on Meta::CPAN
my $headers = [
'Content-Type' => 'application/json',
'X-Requested-With' => 'XMLHttpRequest',
];
# initial_load is fine with just the Cookie, other endpoints like channels/
# require Authorization. We'll just always include both to be sure.
if (exists $self->{'token'}) {
push(@{$headers},
'Cookie' => 'MMAUTHTOKEN=' . $self->{'token'},
'Authorization' => 'Bearer ' . $self->{'token'},
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/HTTP/AnyEvent/Server.pm view on Meta::CPAN
Return URI of a newly created server (with a trailing C</>).
=head2 start_server($prepare_cb)
B<(internal)> Wrapper for the C<tcp_server> from L<AnyEvent::Socket>.
C<$prepare_cb> is used to get the IP address and port of the local socket endpoint and populate respective attributes.
=head1 FUNCTIONS
=head2 _cleanup
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/ReverseHTTP.pm view on Meta::CPAN
use base qw(Exporter);
our @EXPORT = qw(reverse_http);
use Any::Moose;
has endpoint => (
is => 'rw', isa => 'Str',
required => 1, default => "http://www.reversehttp.net/reversehttp",
);
has label => (
lib/AnyEvent/ReverseHTTP.pm view on Meta::CPAN
my $cb = pop;
my @args =
@_ == 1 ? qw(label) :
@_ == 2 ? qw(label token) :
@_ >= 3 ? qw(endpoint label token) : ();
my %args; @args{@args} = @_;
return __PACKAGE__->new(%args, on_request => $cb)->connect;
}
lib/AnyEvent/ReverseHTTP.pm view on Meta::CPAN
my %query = (name => $self->label);
$query{token} = $self->token if $self->token;
my $body = join "&", map "$_=" . URI::Escape::uri_escape($query{$_}), keys %query;
http_post $self->endpoint, $body, sub {
my($body, $hdr) = @_;
if ($hdr->{Status} eq '201' || $hdr->{Status} eq '204') {
my $app_url = _extract_link($hdr, 'related');
$self->on_register->($app_url);
lib/AnyEvent/ReverseHTTP.pm view on Meta::CPAN
return "Hello World"; # You can return HTTP::Response object for more control
};
# more controls over options and callbacks
my $server = AnyEvent::ReverseHTTP->new(
endpoint => "http://www.reversehttp.net/reversehttp",
label => "aedemo1234",
token => "mytoken",
);
$server->on_register(sub {
view all matches for this distribution
view release on metacpan or search on metacpan
t/02_listen_and_invite-anyevent.t view on Meta::CPAN
$uas->listen(
cb_create => sub {
my ($call,$request,$leg,$from) = @_;
diag( 'call created' );
my $response = $request->create_response( '180','Ringing' );
$call->{endpoint}->new_response( $call->{ctx},$response,$leg,$from );
1;
},
cb_established => sub { diag( 'call established' ) },
cb_cleanup => sub {
diag( 'call cleaned up' );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/SlackBot.pm view on Meta::CPAN
type=>'typing',
};
$self->send($msg);
}
=item * $self->post_to_web($msg,$endpoint|undef,"FORM"|"JSON"|undef)
Posts the to the given REST Endpoint outside of the WebSocket.
msg:
Hash ref representing the requrest being sent
token: set to $self->token if not set
scope: set to: 'chat:write:bot' if not set
endpoint:
The Rest xxx endpint, the default is 'chat.postMessage'
type:
Sets how the data will be sent over
Supported options are:
lib/AnyEvent/SlackBot.pm view on Meta::CPAN
- JSON: converts $msg to a json string and posts
=cut
sub post_to_web {
my ($self,$msg,$endpoint,$type)=@_;
$endpoint='chat.postMessage' unless defined($endpoint);
$type='FORM';
$self->stats->{running_posts}++;
my $url="https://slack.com/api/$endpoint";
$msg->{token}=$self->token unless exists $msg->{token};
$msg->{scope}='chat:write:bot' unless exists $msg->{scope};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Twitter/Stream.pm view on Meta::CPAN
=back
=item B<api_url>
Pass this to override the default URL for the API endpoint.
=item B<request_method>
Pass this to override the default HTTP request method.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Twitter.pm view on Meta::CPAN
return bless { %args }, $class;
}
sub get {
my $cb = pop;
my ($self, $endpoint, $params) = @_;
my $type = $endpoint =~ /^http.+\.json$/ ? 'url' : 'api';
$self->request($type => $endpoint, method => 'GET', params => $params, $cb);
return $self;
}
sub post {
my ($self, $endpoint, $params, $cb) = @_;
my $type = $endpoint =~ /^http.+\.json$/ ? 'url' : 'api';
$self->request($type => $endpoint, method => 'POST', params => $params, $cb);
return $self;
}
sub request {
lib/AnyEvent/Twitter.pm view on Meta::CPAN
consumer_secret => $consumer_secret,
callback_url => 'http://example.com/callback',
# auth => 'authenticate',
cb => sub {
my ($location, $response, $body, $header) = @_;
# $location is the endpoint where users are asked the permission
# $response is a hashref of parsed body
# $body is raw response itself
# $header is response headers
},
);
view all matches for this distribution
view release on metacpan or search on metacpan
WebDriver.pm view on Meta::CPAN
if (exists $res->{error}) {
$msg = "AyEvent::WebDriver: $res->{error}: $res->{message}";
$msg .= "\n$res->{stacktrace}caught at" if length $res->{stacktrace};
} else {
$msg = "AnyEvent::WebDriver: http status $status (wrong endpoint?), caught";
}
Carp::croak $msg;
}
WebDriver.pm view on Meta::CPAN
=item new AnyEvent::WebDriver key => value...
Create a new WebDriver object. Example for a remote WebDriver connection
(the only type supported at the moment):
my $wd = new AnyEvent::WebDriver endpoint => "http://localhost:4444";
Supported keys are:
=over
=item endpoint => $string
For remote connections, the endpoint to connect to (defaults to C<http://localhost:4444>).
=item proxy => $proxyspec
The proxy to use (same as the C<proxy> argument used by
L<AnyEvent::HTTP>). The default is C<undef>, which disables proxies. To
WebDriver.pm view on Meta::CPAN
sub new {
my ($class, %kv) = @_;
bless {
endpoint => "http://localhost:4444",
proxy => undef,
persistent => 1,
autodelete => 1,
timeout => 300,
%kv,
WebDriver.pm view on Meta::CPAN
=item $sessionstring = $wd->save_session
Save the current session in a string so it can be restored load with
C<load_session>. Note that only the session data itself is stored
(currently the session id and capabilities), not the endpoint information
itself.
The main use of this function is in conjunction with disabled
C<autodelete>, to save a session to e.g., and restore it later. It could
presumably used for other applications, such as using the same session
WebDriver.pm view on Meta::CPAN
my ($self, $sid, $caps) = @_;
$self->{sid} = $sid;
$self->{capabilities} = $caps;
$self->{_ep} = "$self->{endpoint}/session/$self->{sid}/";
}
=back
=head2 SIMPLIFIED API
WebDriver.pm view on Meta::CPAN
On success, C<< $wd->{sid} >> is set to the session ID, and C<<
$wd->{capabilities} >> is set to the returned capabilities.
Simple example of creating a WebDriver object and a new session:
my $wd = new AnyEvent::WebDriver endpoint => "http://localhost:4444";
$wd->new_session ({});
Real-world example with capability negotiation:
$wd->new_session ({
WebDriver.pm view on Meta::CPAN
sub new_session_ {
my ($self, $kv, $cb) = @_;
$kv->{capabilities} ||= {}; # required by protocol
local $self->{_ep} = "$self->{endpoint}/";
$self->post_ (session => $kv, sub {
my ($status, $res) = @_;
exists $res->{capabilities}
or $status = "500"; # blasted chromedriver
WebDriver.pm view on Meta::CPAN
my $sid = delete $self->{sid};
delete $self->{capoabilities};
return unless defined $sid;
local $self->{_ep} = "$self->{endpoint}/session/$sid";
$self->delete_ ("" => $cb);
}
=item $timeouts = $wd->get_timeouts
WebDriver.pm view on Meta::CPAN
=item $wd->req_ ($method, $uri, $body, $cb->($status, $value))
=item $value = $wd->req ($method, $uri, $body)
Appends the C<$uri> to the C<endpoint/session/{sessionid}/> URL and makes
a HTTP C<$method> request (C<GET>, C<POST> etc.). C<POST> requests can
provide a UTF-8-encoded JSON text as HTTP request body, or the empty
string to indicate no body is used.
For the callback version, the callback gets passed the HTTP status code
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/XMPP/Writer.pm view on Meta::CPAN
}
=item B<send_init_stream ($language, $domain, $namespace)>
This method will generate a XMPP stream header. C<$domain> has to be the
domain of the server (or endpoint) we want to connect to.
C<$namespace> is the namespace URI or the tag (from L<AnyEvent::XMPP::Namespaces>)
for the stream namespace. (This is used by L<AnyEvent::XMPP::Component> to connect
as component to a server). C<$namespace> can also be undefined, in this case
the C<client> namespace will be used.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/ZeroMQ/Types.pm view on Meta::CPAN
$rest =~ /^(?:$interface|$ip);$ip$andport$/;
return 0;
}
return 0;
}, message { 'An endpoint must be in the form "<transport>://<address>"' };
subtype Endpoints, as ArrayRef[Endpoint], message {
'Each endpoint must be in the form "<transport>://<address>"';
};
sub fixup_endpoint() {
s{(^[/])/$}{$1}g;
}
coerce Endpoint, from Str, via { fixup_endpoint };
coerce Endpoints, from ArrayRef[Str], via {
my @array = @$_;
fixup_endpoint for @array;
$_ = [@array];
};
my %allowed_sockettype = map { ZeroMQ::Raw::Constants->$_ => $_ } @socket_constants;
subtype SocketType, as Int, where {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Handle.pm view on Meta::CPAN
read and write queues, EOF status, TLS status and similar properties of
the handle will have been reset.
If, for some reason, the handle is not acceptable, calling C<$retry> will
continue with the next connection target (in case of multi-homed hosts or
SRV records there can be multiple connection endpoints). The C<$retry>
callback can be invoked after the connect callback returns, i.e. one can
start a handshake and then decide to retry with the next host if the
handshake fails.
In most cases, you should ignore the C<$retry> parameter.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SdnFw/js/tinymce/jscripts/tiny_mce/tiny_mce_src.js view on Meta::CPAN
// Setup temp range and collapse it
checkRng = ieRange.duplicate();
checkRng.collapse(start);
// Create marker and insert it at the end of the endpoints parent
marker = dom.create('a');
parent = checkRng.parentElement();
// If parent doesn't have any children then set the container to that parent and the index to 0
if (!parent.hasChildNodes()) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Solr.pm view on Meta::CPAN
sub _core_admin($@)
{ my ($self, $action, $params) = @_;
$params->{core} ||= $self->core;
my $endpoint = $self->endpoint('cores', core => 'admin', params => $params);
my @params = %$params;
my $result = Apache::Solr::Result->new(params => [ %$params ], endpoint => $endpoint, core => $self);
$self->request($endpoint, $result);
$result;
}
sub coreStatus(%)
lib/Apache/Solr.pm view on Meta::CPAN
}
#------------------------
sub endpoint($@)
{ my ($self, $action, %args) = @_;
my $core = $args{core} || $self->core;
my $take = $self->server->clone; # URI
$take->path($take->path . (defined $core ? "/$core" : '') . "/$action");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Voodoo/Soap.pm view on Meta::CPAN
}
my $uri = $self->{'mp'}->uri();
my $filename = $self->{'mp'}->filename();
# if the SOAP endpoint happens to overlap with a directory name
# libapr "helpfully" appends a / to the end of the uri and filenames.
$uri =~ s/\/$//;
$filename =~ s/\/$//;
$filename =~ s/\.tmpl$//;
view all matches for this distribution
view release on metacpan or search on metacpan
conf/server.xml.PL view on Meta::CPAN
subcomponents such as Valves or Loggers at this level.
-->
<Service>
<!--
A Connector represents an endpoint by which requests are received and
response are returned. Each Connector passes requests on to the
associated Container for processing.
By default, a non-secure Connector is enabled. You may also enable a
secure Connector by uncommenting the second Connector
view all matches for this distribution
view release on metacpan or search on metacpan
)
( #$3
( #$4 v
[^>]* #params and
)
\s/> #endpoint
| #or
( #5 v
[^>]* #params and
)
> #closure plus...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apigee/Edge.pm view on Meta::CPAN
for (qw/org usr pwd/) {
$args{$_} || croak "Param $_ is required.";
}
$args{endpoint} ||= 'https://api.enterprise.apigee.com/v1';
$args{timeout} ||= 60; # for ua timeout
return bless \%args, $class;
}
lib/Apigee/Edge.pm view on Meta::CPAN
my $ua = $self->__ua;
my $header = {Authorization => 'Basic ' . b64_encode($self->{usr} . ':' . $self->{pwd}, '')};
$header->{'Content-Type'} = 'application/json' if %params;
my @extra = %params ? (json => \%params) : ();
my $tx = $ua->build_tx($method => $self->{endpoint} . $url => $header => @extra);
$tx->req->headers->accept('application/json');
$tx = $ua->start($tx);
if ($tx->res->headers->content_type and $tx->res->headers->content_type =~ 'application/json') {
return $tx->res->json;
lib/Apigee/Edge.pm view on Meta::CPAN
=item * pwd
required. login password
=item * endpoint
optional. default to https://api.enterprise.apigee.com/v1
=back
view all matches for this distribution
view release on metacpan or search on metacpan
t/pleroma_user.json view on Meta::CPAN
{"@context":["https://www.w3.org/ns/activitystreams","https://queer.hacktivis.me/schemas/litepub-0.1.jsonld",{"@language":"und"}],"alsoKnownAs":[],"attachment":[],"capabilities":{"acceptsChatMessages":true},"discoverable":true,"endpoints":{"oauthAuth...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Chart.pm view on Meta::CPAN
return File::Spec->catfile (File::Basename::dirname($INC{'App/Chart.pm'}),
'Chart', @_);
}
# return true if range ($alo,$ahi) overlaps range ($blo,$bhi)
# each endpoint is taken as inclusive, so say (1,4) and (4,7) do overlap
#
sub overlap_inclusive_p {
my ($alo, $ahi, $blo, $bhi) = @_;
return ! ($ahi < $blo || $alo > $bhi);
}
view all matches for this distribution
view release on metacpan or search on metacpan
- crictl images
- crictl ps -a
- crictl exec -it ... ls
- crictl logs ...
- crictl pods
- crictl --runtime-endpoint (?)
- For DEBUGGING.
# Pods recap (CKAD)
Pod
- Smallest possible creatable object.
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
}
# Submit a form using ajax. (prevents auto reload)
function save_details(endpoint) {
console.log("POST ", endpoint);
const form = document.querySelector("form[id=details]");
const xhttp = new XMLHttpRequest();
xhttp.open("POST", endpoint);
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhttp.send( $("#details").serialize() );
}
## JQuery - Ajax
#############################################################
# Submit a form using ajax. (structured format,compact)
function submit_form(file_root_name) {
const endpoint = "/my_endpoint";
console.log("POST ", endpoint);
$.ajax({
url: endpoint,
headers: {
'Content-type': 'application/x-www-form-urlencoded',
},
method: 'POST',
data: $("#id").serialize(),
perl -Mojo -E 'a("/hello" => { text => "Welcome!" } )->start' daemon
perl -Mojo -E 'say a("/hello" => {text => "Hello Mojo!"})->start("daemon")'
perl -Mojo -E 'say a("/hello" => {text => "Hello Mojo!"})->start("daemon", "-l", "http://*:8080")'
mojo get http://127.0.0.1:3000/
#
# View local files on an endpoint:
perl -Mojo -E 'say a("/" => {text => "Hello Mojo!"}); a("ls" => sub{ my @files = glob "*/*"; $_->render( json => \@files) } )->start("daemon")'
mojo get http://127.0.0.1:3000/ls
#
# Show a message on connection.
perl -Mojo -E 'a("/" => sub{ say $_->req->to_string; $_->render( text => "123") })->start' daemon
#
import json
class Server:
def info(self):
try:
return json.dumps(possible_endpoints)
except KeyError:
return bottle.HTTPError(404, "Error occurred")
#############################################################
view all matches for this distribution
view release on metacpan or search on metacpan
v1.1.1 - 2024-11-18
* Update to new API endpoints on cveawg.mitre.org (same data schema)
v1.1.0 - 2024-05-14
* Add support for CVE Schema 5.1
v1.0.5 - 2023-10-14
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/DuckPAN/Web.pm view on Meta::CPAN
my ($wrap_jsonp_callback, $callback, $wrap_string_callback, $missing_envs, $headers) =
($rewrite->wrap_jsonp_callback, $rewrite->callback, $rewrite->wrap_string_callback, defined($rewrite->missing_envs), $rewrite->headers);
# Check if environment variables (most likely the API key) is missing.
# If it is missing, switch to the DDG endpoint.
my ($use_ddh, $request_uri);
if ($missing_envs) {
++$use_ddh;
$request_uri = $request->request_uri;
# Display the URL that we used.
print "\nAPI key not found. Using DuckDuckGo's endpoint:\n";
}
$to = "https://beta.duckduckgo.com$request_uri" if $use_ddh;
my $h = HTTP::Headers->new( %$headers );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Egaz/Command/formats.pm view on Meta::CPAN
my $desc .= <<MARKDOWN;
* [lav format](http://www.bx.psu.edu/miller_lab/dist/lav_format.html)
Here <start> and <stop> are origin 1 (i.e. the first base in the original
given sequence is called '1') and inclusive (both endpoints are included
in the interval).
* [psl format](https://genome.ucsc.edu/FAQ/FAQformat.html#format2)
Be aware that the coordinates for a negative strand in a PSL line are
view all matches for this distribution