Pārlūkot izejas kodu

move to correct path

nas 2 gadus atpakaļ
vecāks
revīzija
0a8564226d
3 mainītis faili ar 51 papildinājumiem un 0 dzēšanām
  1. 10
    0
      test/remote/get_companies.pl
  2. 6
    0
      test/remote/test.cfg.sample
  3. 35
    0
      test/remote/test.pl

+ 10
- 0
test/remote/get_companies.pl Parādīt failu

@@ -0,0 +1,10 @@
1
+#!/usr/bin/perl
2
+
3
+my $country_code="fr"
4
+
5
+print "La documentation de l'api est disponible ici : http://api.opencorporates.com/documentation/API-Reference";
6
+
7
+# Édition logiciel
8
+#curl curl https://api.opencorporates.com/v0.4/industry_codes/fr_naf_2008/58.29B
9
+#curl https://api.opencorporates.com/v0.4.1/companies/search?industry_codes=fr_naf_2008&country_code=fr;
10
+#https://api.opencorporates.com/v0.4/companies/search?q=traxis&country_code=fr

+ 6
- 0
test/remote/test.cfg.sample Parādīt failu

@@ -0,0 +1,6 @@
1
+[Authentification]
2
+Protocol : https
3
+Host : localhost
4
+Path : api/v1/ 
5
+Username : test_remote
6
+Password : NJfccjabWSXqmpTRhfXRs6Re2CAIsJyhz3TAo4rpWz2nlMgWqTScmbsXoIlwdHB1

+ 35
- 0
test/remote/test.pl Parādīt failu

@@ -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" );

Notiek ielāde…
Atcelt
Saglabāt