s-aska / p5-webservice-dropbox Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
I couldn't find a way to use a refresh token, and eventually read the source and found refresh_access_token
right there. It should probably get documented.
Hi,
I think the sharing APIv2 call that replaces the /shares APIv1 call is not available in v2.05 of the Perl module. See https://www.dropbox.com/developers/documentation/http/documentation#sharing
More specifically I am interested in this call: /2/sharing/get_shared_link_file
(https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file) to retrieve a URL for a file I have just uploaded.
Currently there is no possibility in the Perl APIv2 implementation to retrieve a URL for a file that was just uploaded.
It looks like none of the calls under /2/sharing are implemented in module version 2.05.
I fiddled around with the module a little bit, and I implemented a "working" version with this patch:
hostname:~ root# diff -u /Library/Perl/5.18/WebService/Dropbox/Files.pm.original /Library/Perl/5.18/WebService/Dropbox/Files.pm
--- /Library/Perl/5.18/WebService/Dropbox/Files.pm.original 2016-10-02 12:54:59.000000000 +0200
+++ /Library/Perl/5.18/WebService/Dropbox/Files.pm 2016-10-02 12:52:10.000000000 +0200
@@ -245,4 +245,20 @@
});
}
+# https://www.dropbox.com/developers/documentation/http/documentation#sharing
+# /2/sharing/create_shared_link_with_settings
+sub sharing_create_shared_link_with_settings {
+ my ($self, $path, $optional_params) = @_;
+
+ my $params = {
+ path => $path,
+ %{ $optional_params || {} },
+ };
+
+ $self->api({
+ url => 'https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings',
+ params => $params,
+ });
+}
+
1;
Which allows me to use this Perl call:
$data = $dropbox->sharing_create_shared_link_with_settings($stripped_article_out_pdf) or do {
. . .
Could you please implement this functionality one way or another. The above code is only "proof-of-concept'...
Best regards!
ドキュメントが足りないので書き足す。
I'm downloading files from a Dropbox app like:
my $fh_get = IO::File->new("$dir/$name", '>');
$dropbox->files($name, $fh_get) or die $dropbox->error;
It completes without error, but (due to some failure on my part, I'm sure) the contents of the file is:
{"error": "Given request root of \"dropbox\" but app is an App Folder app."}
It looks like we got a 200 response, but the body is a JSON error object. No $dropbox->error is set, though there is definitely an error.
You must use binmode for getting file. For example in windows system all binary file will be corrupt.
lib/WebService/Dropbox.pm
http://www.sendspace.com/file/00qdk4 This is patch file.
no_docode_json は no_decode_json ではないでしょうか?
no_docode_json => $args->{no_docode_json} || 0,
使いやすくて助かります。
(MY)META.* are auto-generated files so that they should not be saved in the repo.
I need handle errors by myself.
I test some file exists or not exists calling get_matadata in particularly
2022-06-14T15:57:49 [WebService::Dropbox] [ERROR] https://api.dropboxapi.com/2/files/get_metadata {"path":"/files/q/4.txt"} -> [409] {"error_summary": "path/not_found/...", "error": {".tag": "path", "path": {".tag": "not_found"}}} at /usr/local/share/perl5/WebService/Dropbox.pm line 184.
I've solved this like that:
my $meta = eval { local $SIG{__WARN__} = sub {}; $dropbox->get_metadata($file); };
But maybe exists a more eligant way...
Hello,
I love your WebService::Dropbox, however there's a small bug in your sample code:
The $box variable should be $dropbox.
Kind regards,
WebService::Dropbox works fine with ansii files, but some files with special unicode strings are uploaded incorrectly. I'm using LWP backend, not Furl::Net.
Here is an example scrip showing the problem:
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use utf8;
use open qw(:std :utf8);
use WebService::Dropbox;
my $dropbox = WebService::Dropbox->new({
key => '...',
secret => '...',
});
$dropbox->access_token('...');
$dropbox->access_secret('...');
$dropbox->root('sandbox');
my $content = "f\nтст";
open(my $fh, "<:encoding(UTF-8)", \$content)
or die "can't open UTF-8 encoded filename: $!";
$dropbox->files_put('file', $fh) or die $dropbox->error();
After I run it I get file with the name 'file' in my dropbox app folder. But the content of the file is not what I expect.
I expect it to be:
$ cat file
f
тст
$ hexdump file
0000000 0a66 82d1 81d1 82d1 000a
0000009
But in fact I get:
$ cat file
f
т
[0;32m$ hexdump file
0000000 0a66 82d1 66d1 d10a
0000008
Hi,
is it possible remove this part or make it configurable?
p5-WebService-Dropbox/lib/WebService/Dropbox.pm
Lines 184 to 191 in 731a4d9
While using the module with, for example, mod_perl, it pollutes the apache error log with warnings even if VERBOSE == 0. Additionally it may leak the Dropbox secret to the log.
Turning verbosity on leads to a crash for me:
Can't locate object method "path" via package "https://content.dropboxapi.com/2/files/download" (perhaps you forgot to load "https://content.dropboxapi.com/2/files/download"?) at /usr/local/share/perl/5.18.2/WebService/Dropbox.pm line 162.
Using version 2.05.
It looks as though the download() sub accepts a file path as its $output argument and if it does it opens the file, but I don't see a close() anywhere in the code. I'm not sure how to close the file since the filehandle created by the module isn't exposed anywhere.
Yeah, I can just use a filehandle instead, but I shouldn't have to if it takes a path..
Can you give an example for how to use it to upload file of 1gb
Is it possible to add OAuth 2.0 in to your interface?
thanks!
Hello,
Dropbox has announced changes in their token access system:
https://dropbox.tech/developers/migrating-app-permissions-and-access-tokens
On September 30th, 2021 Dropbox will retire the old token system.
There were no code updates in this project since 2017 so I wonder whether there is a plan to implement the required changes before that.
the "files" method can download file, but sometimes we need know files url,
eg. html5 audio src file.
so I think we need a method to get files url, what do you think? :-)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.