move to correct path
This commit is contained in:
parent
a68bc7f8c0
commit
0a8564226d
3 changed files with 51 additions and 0 deletions
10
test/remote/get_companies.pl
Normal file
10
test/remote/get_companies.pl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
my $country_code="fr"
|
||||
|
||||
print "La documentation de l'api est disponible ici : http://api.opencorporates.com/documentation/API-Reference";
|
||||
|
||||
# Édition logiciel
|
||||
#curl curl https://api.opencorporates.com/v0.4/industry_codes/fr_naf_2008/58.29B
|
||||
#curl https://api.opencorporates.com/v0.4.1/companies/search?industry_codes=fr_naf_2008&country_code=fr;
|
||||
#https://api.opencorporates.com/v0.4/companies/search?q=traxis&country_code=fr
|
||||
6
test/remote/test.cfg.sample
Normal file
6
test/remote/test.cfg.sample
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[Authentification]
|
||||
Protocol : https
|
||||
Host : localhost
|
||||
Path : api/v1/
|
||||
Username : test_remote
|
||||
Password : NJfccjabWSXqmpTRhfXRs6Re2CAIsJyhz3TAo4rpWz2nlMgWqTScmbsXoIlwdHB1
|
||||
35
test/remote/test.pl
Normal file
35
test/remote/test.pl
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/perl
|
||||
# @file journal.pl
|
||||
# @author nas
|
||||
# @date 31/01/2022
|
||||
# @brief Remote call to the API in order to test
|
||||
|
||||
use Config::Std;
|
||||
use LWP::UserAgent ();
|
||||
|
||||
read_config 'test.cfg' => my %config;
|
||||
print "Username : $config{Authentification}{Username}\n";
|
||||
print "Host : $config{Authentification}{Host}\n";
|
||||
print "Host : $config{Authentification}{Path}\n";
|
||||
print "Protocol : $config{Authentification}{Username}\n";
|
||||
|
||||
local $url = "$config{Authentification}{Host}$config{Authentification}{Path}";
|
||||
local $ua = LWP::UserAgent->new(timeout => 10);
|
||||
$ua->env_proxy;
|
||||
|
||||
sub rq {
|
||||
my $path = (exists $_[0])? $_[0] : "";
|
||||
my $response = $ua->get( "$url$path" );
|
||||
print "rq $url$path\n";
|
||||
if ($response->is_success) {
|
||||
print $response->decoded_content;
|
||||
print "\n";
|
||||
}
|
||||
else {
|
||||
print $response->status_line;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
rq();
|
||||
rq( "tokens" );
|
||||
Loading…
Add table
Add a link
Reference in a new issue