Backblaze-B2V2Client
view release on metacpan or search on metacpan
They are continuing to support their native B2 API, so I will continue
to use and support this module. I have not tested the S3 modules with
Backblaze, but if you already have an S3 integration, it is worth
checking out how Paws::S3 or Awes::S3 works with Backblaze.
## Testing Your Credentials
During install, this module will attempt to connect to B2 and download
a 16KB file into memory. To test using your B2 account
credentials, set these environmental varables prior to attempting
to install:
B2_APP_KEY_ID - The application key ID for the key you wish to test.
B2_APP_KEY - The application key -- is never displayed in the B2 UI.
B2_ACCT_ID - Your account ID; will be the ID of your master key
B2_TEST_FILE_ID: The long (75+ char) GUID for your target file.
The GUID for a file is displayed when you click on that file's name
in the 'Browse Files' section of the B2 UI.
lib/Backblaze/B2V2Client.pm view on Meta::CPAN
They are continuing to support their native B2 API, so I will continue
to use and support this module. I have not tested the S3 modules with
Backblaze, but if you already have an S3 integration, it is worth
checking out how Paws::S3 or Awes::S3 works with Backblaze.
=head2 Testing Your Credentials
During install, this module will attempt to connect to B2 and download
a 16KB file into memory. To test using your B2 account
credentials, set these environmental varables prior to attempting
to install:
B2_APP_KEY_ID - The application key ID for the key you wish to test.
B2_APP_KEY - The application key -- is never displayed in the B2 UI.
B2_ACCT_ID - Your account ID; will be the ID of your master key
B2_TEST_FILE_ID: The long (75+ char) GUID for your target file.
The GUID for a file is displayed when you click on that file's name
in the 'Browse Files' section of the B2 UI.
t/00_compile.t view on Meta::CPAN
);
# let them use ENV vars to test their account
my $application_key_id = $ENV{B2_APP_KEY_ID} || '002dcecbc999f31000000000e';
my $application_key = $ENV{B2_APP_KEY} || 'K002cbUnOGDiTATcLQvac+pDTVjghC8';
my $account_id = $ENV{B2_ACCT_ID} || 'dcecbc999f31';
my $test_file_id = $ENV{B2_TEST_FILE_ID} || '4_z1dbcfe6ccb7cb959793f0311_f111f065d1a8a36cf_d20200803_m192431_c002_v0001142_t0011';
# test logging in
my $b2client = Backblaze::B2V2Client->new($application_key_id, $application_key);
my $connection_words = 'Could not connect or authenticate to Backblaze. If you set your account ID and application keys, please check those and/or test with the included keys. Please contact me if the supplied credentials are not working.';
ok($b2client->{account_id} eq $account_id, $connection_words );
like($b2client->{account_authorization_token}, qr/4\_$application_key_id/, $connection_words );
# test file download
my $current_status = $b2client->b2_download_file_by_id($test_file_id);
ok($b2client->{current_status} eq 'OK', 'Test file could not be downloaded; B2 Msg: '.$b2client->latest_error() );
ok( length($b2client->{b2_response}{file_contents}) > 15000, 'Test file did not download properly; B2 Msg: '.$b2client->latest_error() );
# that's enough for now
done_testing;
( run in 0.249 second using v1.01-cache-2.11-cpan-a5abf4f5562 )