File: app.pl

package info (click to toggle)
libwebservice-dropbox-perl 2.10-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 360 kB
  • sloc: perl: 885; makefile: 2
file content (71 lines) | stat: -rw-r--r-- 1,540 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use strict;
use warnings;

use WebService::Dropbox;

my $key = $ENV{DROPBOX_APP_KEY};
my $secret = $ENV{DROPBOX_APP_SECRET};
my $access_token = $ENV{DROPBOX_ACCESS_TOKEN};

my $box = WebService::Dropbox->new({
    key => $key,
    secret => $secret,
});

$box->debug;
$box->verbose;

if ($access_token) {
    $box->access_token($access_token);
} else {
    my $url = $box->authorize;

    print "Please Access URL and press Enter: $url\n";
    print "Please Input Code: ";

    chomp( my $code = <STDIN> );

    unless ($box->token($code)) {
        die $box->error;
    }

    print "Successfully authorized.\nYour AccessToken: ", $box->access_token, "\n";
}

my $res = $box->search('/Photos', '39.jpg');

# use Data::Dumper;
# warn Dumper($res);


# {
#     my $res = $box->get_current_account;
#     my $account_id = $res->{account_id};
#     $box->get_account($account_id);
#     $box->get_account_batch([ $account_id ]);
#     $box->get_space_usage;
# }

# # use Data::Dumper;
# # warn Dumper($res);

# {
#     my $res = $box->download('/aerith.json', './aerith.json');
#     # warn Dumper($res);
# }

# {
#     open(my $fh, '<', './aerith.json');
#     # $box->debug;
#     my $res = $box->upload_session('/aerith-test.json', $fh, { mode => 'overwrite' }, 20000);
#     # warn Dumper($res);
# }

# {
#     open(my $fh, '>', './hoge.pdf');
#     # $box->debug;
#     my $res = $box->get_preview('/work/recruit/職務経歴書.doc', $fh);
#     my $ct = $box->res->header('Content-Type');
#     warn $ct;
#     # warn Dumper($res);
# }