s-aska / dropbox-api-command Goto Github PK
View Code? Open in Web Editor NEWcommand line interface to access Dropbox API
License: MIT License
command line interface to access Dropbox API
License: MIT License
Currently if you upload ABC.txt and then download you may get two copies - both ABC.txt and abc.txt.
Since dropbox is "case insensitive" and downloads ~arbitrarily with correct case or lower case, the dropbox-api should check if a file/directory exists with different case when syncing (rather than exact case match).
When you use the sync option to sync files from dropbox to local directory, the modified time on the downloaded files is set to the local time. This means that when you then try and sync from local directory back to dropbox, it views all files as having been modified more recently and so tries to upload them back to dropbox.
I have created a patch below so that when files are downloaded, the modification time is set on the local file to be the same as the modified time on dropbox. Can it be added to the main source please.
Thanks
--- dropbox-api.orig 2012-08-14 09:56:36.000000000 +0100
+++ dropbox-api 2012-08-14 09:35:21.000000000 +0100
@@ -529,6 +529,9 @@
unlink($local_path_tmp);
warn "rename failure " . $local_path_tmp;
}
unless (utime($remote_epoch, $remote_epoch, $local_path)) {
warn "set modification time failure " . $local_path;
}
} else {
printf "skip %s\n", $rel_path if $verbose;
}
Was getting "FAIL Installing Net::SSLeay failed." error on Ubuntu 16.04.4 x64. libssl-dev was installed per https://stackoverflow.com/questions/21729975/error-installing-in-netssleay
Fixed the issue by doing...
sudo apt-get install libnet-ssleay-perl
...followed by...
sudo perl ./cpanm App::dropboxapi
To return sizes of files/dirs.
$ dropbox-api put data.GoPro/2017-01-23T07.25.11.000000Z.m4v dropbox:/
2017-02-06T19:57:50 [WebService::Dropbox] [ERROR] https://content.dropboxapi.com/2/files/upload {"mode":"overwrite","path":"/2017-01-23T07.25.11.000000Z.m4v"} -> [413] <!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Dropbox - 4xx</title>
<link href="https://www.dropbox.com/static/css/error.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="//www.dropbox.com/static/images/favicon-tarak.ico"/>
</head>
<body>
<div class="figure">
<img src="https://www.dropbox.com/static/images/psychobox.png" alt="Error: 4xx"/>
</div>
<div id="errorbox">
...
That's unnecessary and makes it hard to use when my console floods with HTML and JavaScript gibberish.
It'd be nice to have manpages generated since there's already perldoc for it.
sync コマンドでdropboxから ファイル名(かフォルダー名)に "+", "#", "=" などの特徴文字が含まれたファイルを取得際に次のようなエラーが起きています。
$dropbox-api sync dropbox:/c++-mode ./ -v
** download **
Hello, thank you very much for this great API and command, it is vital for me on my ARM notebook.
The app sync works well. However, I encountered an issue with 'bad' file names:
# dropbox-api sync dropbox:/ /media/removable/SD\ Card/Dropbox
mkpath /var/host/media/removable/SD Card/Dropbox/Library/
Can't write to /var/host/media/removable/SD Card/Dropbox/Library/0006-3568(2001)051[0341:lndats]2.0.co;2.pdf.dropbox-api.tmp:
Invalid argument at /usr/bin/site_perl/dropbox-api line 588.
It fails as the name contains a semicolon. These files should be skipped, or maybe there is another way to still write them. (Locally I just added a return if ($local_path=~ /;/);
, but that might not be the best way)
Hi,
The FreeBSD port for dropbox-api-command uses the github tagname to fetch the source. I'm working on updating the port, but there doesn't seem to be a tag for the latest release. Can you please tag v1.13?
Thanks,
Andrew
myname# dropbox-api setup
Please Input API Key: ********
Please Input API Secret: ********
Something went wrong: 401 Unauthorized at /usr/local/lib/perl5/site_perl/5.10.1/Net/Dropbox/API.pm line 104, line 2.
401 Unauthorized at /usr/local/bin/dropbox-api line 302, line 2.
What is going wrong? Help me.
The sync runs well without the -d
option. However, it shows multiple times Exiting subroutine via next at /usr/bin/dropbox-api line 626.
if the -d
option is present. Please tell me if you need more information. Thanks.
PS. I am using 1.14 because 1.15 has not hit cpan yet.
Dear Sir
I'm use dropbox-api-command in freebsd 12.1 and perl5.30.
use dropbox-api command and show this error.
panic: XSUB Package::Stash::XS::list_all_symbols (XS.c) failed to extend arg stack: base=801a26e18, sp=801a26e80, hwm=801a26e40
Compilation failed in require at /usr/local/lib/perl5/site_perl/mach/5.30/DateTime/Duration.pm line 12.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/mach/5.30/DateTime/Duration.pm line 12.
Compilation failed in require at /usr/local/lib/perl5/site_perl/mach/5.30/DateTime.pm line 14.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/mach/5.30/DateTime.pm line 14.
Compilation failed in require at /usr/local/bin/dropbox-api line 6.
BEGIN failed--compilation aborted at /usr/local/bin/dropbox-api line 6.
this error problem is my setting?
Please help this error fix.
Best Regards.
I am getting the following warning message:
~# dropbox-api ls
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is depreciated! Please set SSL_verify_mode to SSL_VERIFY_PEER
together with SSL_ca_file|SSL_ca_path for verification.
If you really don't want to verify the certificate and keep the
connection open to Man-In-The-Middle attacks please set
SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
at /usr/local/share/perl/5.14.2/Furl/HTTP.pm line 577.
Looks like this might be due to
http://cpansearch.perl.org/src/SULLR/IO-Socket-SSL-1.79/Changes
Or am I doing something wrong here?
Cheers,
Wautr
Hi,
Whenever I run "dropbox-api find" command it returns the following error on all directories:
"Something went wrong: 400 Bad Request at /usr/local/lib/perl5/site_perl/5.12.2/Net/Dropbox/API.pm line 461."
It lists files fine for the root of my dropbox directory, but for all directories I get the error above. If i try t run it on asub-directory - e.g. "dropbox-api find /subdir" I also get the above error and none of the files in the subdir are listed.
Any suggestions as to what the problem maybe or how I can diagnose what's going on? Thanks in advance.
Richard
Feature request: add --verbose
(and short-form -v
) option for dropbox-api put
to display transfer progress information.
On FreeBSD 12-current r310018, I am getting the following error when trying to sync with dropbox-api-command-2.09:
$ dropbox-api sync dropbox:/ Dropbox/
Can't call method "epoch" on an undefined value at /usr/local/bin/dropbox-api line 1115.
Line 1115 is:
my $remote_epoch = $strp->parse_datetime($content->{client_modified})->epoch;
Note that I have p5-DateTime-Format-Strptime-1.70 installed.
Any ideas what this could be?
dropbox-api requires Encode::Locale and Encode::UTF8Mac (for me, on OSX 10.7). Perhaps this is OS-specific, but thought I might suggest that the readme could mention those requirements as well.
With those installed (cpanm Encode::Locale Encode::UTF8Mac
), appears to work fine on OSX. Thanks!
Uploads fail with 413 on large files because file_upload isn't meant for large files. Files >150M should use:
Error message appears while syncing a folder to dropbox:
Failed to read request content: at /usr/local/share/perl5/WebService/Dropbox.pm line 406.
Hi,
This:
$ mkdir .diff/foo
$ touch .diff/foo/bar
$ dropbox-api sync .diff dropbox:/diffs/ -d
upload foo/bar /diffs/foo/bar
mktree foo /diffs/foo
2018-02-14T13:40:43 [WebService::Dropbox] [ERROR] https://api.dropboxapi.com/2/files/create_folder {"path":"/diffs/foo"} -> [409] {"error_summary": "path/conflict/folder/..", "error": {".tag": "path", "path": {".tag": "conflict", "conflict": {".tag": "folder"}}}} at /usr/local/lib/perl5/site_perl/WebService/Dropbox.pm line 184.
{"error_summary": "path/conflict/folder/..", "error": {".tag": "path", "path": {".tag": "conflict", "conflict": {".tag": "folder"}}}} at /usr/local/bin/dropbox-api line 1014.
I am not quite sure why this happens, but what seems to happen is that it first uploads foo/bar
, which creates the foo
directory automatically, and then, it tries to create the foo
directory and fails because it is already there.
I use freebsd 11.
I'm trying to put the script in cron:
#!/bin/bash
command='dropbox-api sync dropbox:/teste/ /teste/ -Dv'
NEXT_WAIT_TIME=0
EXIT_CODE=0
until $command || [ $NEXT_WAIT_TIME -eq 4 ]; do
EXIT_CODE=$?
sleep $NEXT_WAIT_TIME
let NEXT_WAIT_TIME=NEXT_WAIT_TIME+1
done
exit $EXIT_CODE
But I get the error:
env: perl: No such file or directory
1
env: perl: No such file or directory
2
env: perl: No such file or directory
3
env: perl: No such file or directory
4
env: perl: No such file or directory
Can someone help me?
Hi,
I've installed the xCode Developer Tools.
curl -O https://raw.github.com/miyagawa/cpanminus/master/cpanm fails to transfer anything. I grabbed the cpanm installation directly from http://cpanmin.us
sudo perl cpanm App::dropboxapi runs, but dropbox-api does not recognize as a command.
I found a failure report about dropbox-api, It could be blamed for Furl, though.
http://www.lifewithunix.jp/notes/2012/12/20/problems-dropbox-api-on-freebsd/
I have seen no such an issue but I'm going to use dropbox-api (or WebSerivice::Dropbox directly), so I'd like the issue to be solved.
Thanks,
$ ./dropbox-api setup
Please Input API Key: ------------------------
Please Input API Secret: ------------------------
Something went wrong: 501 Protocol scheme 'https' is not supported (Crypt::SSLeay or IO::Socket::SSL not installed) at /usr/local/share/perl/5.10.1/Net/Dropbox/API.pm line 104, line 2.
501 Protocol scheme 'https' is not supported (Crypt::SSLeay or IO::Socket::SSL not installed) at ./dropbox-api line 302, line 2.
What is going wrong?
Can you help or advice?
The environment variable for an HTTP proxy is typically lowercase. See w3.org[1] and a tutorial for other tools[2].
[1]http://www.w3.org/Daemon/User/Proxies/ProxyClients.html
[2]http://www.cyberciti.biz/faq/linux-unix-set-proxy-environment-variable/
i can't setup a new app:
floswald@m0:~$ dropbox-api ls
Please Input API Key: ******
Please Input API Secret: ******
1. Open the Login URL: https://www.dropbox.com/oauth2/authorize?client_id=********&response_type=code
2. Input code and press Enter: **********************************
2018-04-18T10:33:33 [WebService::Dropbox] [ERROR] https://api.dropboxapi.com/oauth2/token {"client_id":"*****************","grant_type":"authorization_code","client_secret":"********","code":"**********************"} -> [400] {"error": "invalid_client: Invalid client_id or client_secret"} at /usr/local/share/perl/5.22.1/WebService/Dropbox.pm line 184, <STDIN> line 3.
{"error": "invalid_client: Invalid client_id or client_secret"} at /usr/local/bin/dropbox-api line 402, <STDIN> line 3.
any ideas?
The README misses very important information: "How to SAFELY perform 2-way synchronization?".
For example - if I start periodically from cron such script:
#!/bin/sh
dropbox-api-command sync dropbox:/ ~/Dropbox -d
dropbox-api-command sync ~/Dropbox dropbox:/ -d
It seems to work fine, but... is it really safe? What can happen if one file was changed on both sides simultaneusly? Is there any race condition here possiible here? What if I add a new file when the synchronization is already half-way? Will the script do something reasonable then? Are there any disadvantages/dangers of running such script from cron without human supervision?
delete .znc/users/infogulch-freenode/moddata/moddata/log/#notepad++_20110827.log
Nested quantifiers in regex; marked by <-- HERE in m/^.znc/users/infogulch-freenode/moddata/moddata/log/#notepad++ <-- HERE _20110827.log / at /home/infogulch/bin/dropbox-api line 614.
Calling a dynamic regex from user input (paths) without first escaping said input? tsk, tsk, tsk...
:-P
I am trying to upload large (> 2G) files to dropbox folder and get the following errors
tom% TMPDIR=/var/tmp dropbox-api put /usr/home/backups/c-tom-backup.16-10-11_03:30:00.tbz dropbox:/tom/c-tom-backup.16-10-11_03:30:00.tbz
2016-10-11T17:54:25 [WebService::Dropbox] [ERROR] https://content.dropboxapi.com/2/files/upload {"path":"/tom/c-tom-backup.16-10-11_03:30:00.tbz","mode":"overwrite"} -> [404] <html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
Sometimes, the upload succeeds, but this is very rare event, say 1 in 20 tries. For short files, the put command seems to work reliably.
dropbox-api 2.09, perl 5.24 rc3, freebsd 9/stable amd64.
It shows
$ dropbox-api rm dropbox:/ab\ c.txt
{"error": "Invalid signature. Expected signature base string: POST&https%3A%2F%2Fapi.dropbox.com%2F1%2Ffileops%2Fdelete&oauth_consumer_key%3DXXX%26oauth_nonce%3DXXX%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1345747184%26oauth_token%3DXXX%26oauth_version%3D1.0%26path%3D%252Fdropbox%253A%252Fab%2520c.txt%26root%3Ddropbox"} at /home/eddyxu/bin/dropbox-api line 428.
It is ok to upload the files with spaces in file names.
Looks like Dropbox has a new API.
Trying to upload a large (~600 MB) file via dropbox-api put
is failing:
$ dropbox-api put /path/to/file dropbox:/Public/path/to/file
Failed to send content: Broken pipe at /Library/Perl/5.12/WebService/Dropbox.pm line 316.
I know that the Dropbox web interface won't accept file uploads larger than ~300 MB, but the website claims that the desktop app. can handle larger files. What API/method is the desktop app. using vs. the dropbox-api
and WebService::Dropbox
module?
dropbox-api
and WebService::Dropbox
aren't using the same API/method to access Dropbox as the desktop app., why not?I'm having a lot of errors when using sync.
Here's the example:
2017-06-13T19:40:24 [WebService::Dropbox] [ERROR] https://api.dropboxapi.com/2/files/create_folder {"path":"/teste/Biblioteca/5S"} -> [409] {"error_summary": "path/conflict/folder/...", "error": {".tag": "path", "path": {".tag": "conflict", "conflict": {".tag": "folder"}}}} at /usr/local/lib/perl5/site_perl/WebService/Dropbox.pm line 184.
{"error_summary": "path/conflict/folder/...", "error": {".tag": "path", "path": {".tag": "conflict", "conflict": {".tag": "folder"}}}} at /usr/local/bin/dropbox-api line 1014.
I use freebsd 11.
It is configured with etf8.
And I was using api to sync a samba folder
When i tryed to sync .tar.gz file (237Mb) i got:
Unexpected EOF while reading response header at /usr/local/lib/perl5/site_perl/5.10.1/WebService/Dropbox.pm line 290
p.s. with smaller files a had no problems
FreeBSD 8.2, dropbox-api installed from PORT
ls, uid - working fine
sync - i get output that all my files (3 .gz files) uploaded, but i know that it can't be truth (files ~100Mb in 20-30sec.) and realy uploaded only first file (6Mb).
put - don't work at all, always shows connection error by timeout.
CentOS installation
App::dropboxapi is up to date. (2.12)
Please Input API Key: ***************
Please Input API Secret: ***************
Undefined subroutine &HTTP::Request::Common::request_type_with_data called at /usr/local/share/perl5/WebService/Dropbox.pm line 242, line 3.
Hello! Forgive my bad english.
When I try to copy a 250 MB file, I see a huge memory usage: above 2.5 GB!
Thnaks for utility!
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.