|
@@ -0,0 +1,35 @@
|
|
1
|
+#!/usr/bin/perl
|
|
2
|
+# @file journal.pl
|
|
3
|
+# @author nas
|
|
4
|
+# @date 31/01/2022
|
|
5
|
+# @brief Remote call to the API in order to test
|
|
6
|
+
|
|
7
|
+use Config::Std;
|
|
8
|
+use LWP::UserAgent ();
|
|
9
|
+
|
|
10
|
+read_config 'test.cfg' => my %config;
|
|
11
|
+print "Username : $config{Authentification}{Username}\n";
|
|
12
|
+print "Host : $config{Authentification}{Host}\n";
|
|
13
|
+print "Host : $config{Authentification}{Path}\n";
|
|
14
|
+print "Protocol : $config{Authentification}{Username}\n";
|
|
15
|
+
|
|
16
|
+local $url = "$config{Authentification}{Host}$config{Authentification}{Path}";
|
|
17
|
+local $ua = LWP::UserAgent->new(timeout => 10);
|
|
18
|
+$ua->env_proxy;
|
|
19
|
+
|
|
20
|
+sub rq {
|
|
21
|
+ my $path = (exists $_[0])? $_[0] : "";
|
|
22
|
+ my $response = $ua->get( "$url$path" );
|
|
23
|
+ print "rq $url$path\n";
|
|
24
|
+ if ($response->is_success) {
|
|
25
|
+ print $response->decoded_content;
|
|
26
|
+ print "\n";
|
|
27
|
+ }
|
|
28
|
+ else {
|
|
29
|
+ print $response->status_line;
|
|
30
|
+ print "\n";
|
|
31
|
+ }
|
|
32
|
+}
|
|
33
|
+
|
|
34
|
+rq();
|
|
35
|
+rq( "tokens" );
|