riscfuture / dropbox Goto Github PK
View Code? Open in Web Editor NEWAn easy-to-use client library for the official Dropbox API.
License: MIT License
An easy-to-use client library for the official Dropbox API.
License: MIT License
Hi!
I have a very basic issue using this gem and I haven't figure out yet what is actually wrong. Maybe someone had the same problem?
So, configuration is:
rails (2.3.11)
ruby-1.9.2-p290
oauth (0.4.5)
dropbox (1.3.0)
(...)
controller action fails at this line (yes, very first, APP_KEY and APP_SECRET are the values obtained at dropbox pages):
dropbox_session = Dropbox::Session.new(APP_KEY, APP_SECRET)
it results with:
401 Unauthorized
and application trace...
.../gems/oauth-0.4.5/lib/oauth/consumer.rb:219:in 'token_request'
.../gems/oauth-0.4.5/lib/oauth/consumer.rb:139:in 'get_request_token'
.../gems/dropbox-1.3.0/lib/dropbox/session.rb:70:in 'initialize'
.../app/controllers/files_controller.rb:94:in 'new'
.../app/controllers/files_controller.rb:94:in 'authorize'
when am trying to initialize session using dropbox_sdk.rb file things are working (but I prefer using gems)
what am I doing wrong? can someone give me a hint because I am running out of ideas!
Thanks a lot! ;)
The extension Array#to_hash
in this gem breaks Kernel.exec
when called with these params:
[cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)
Observed on ruby 1.9.3-p448 and 2.0.0-p247. The nature of the failure is an ENOENT exception where it appears that exec attempted to execute the first argument rather than the executable. Demonstration gist.
This form of Kernel.exec
is used by childprocess
which is used by selenium-webdriver
, so this interference prevents an application which uses this gem from being tested with selenium-webdriver
(via capybara
or otherwise).
The dropbox gem only checks for an existing @access_token. If the app has a valid access token but the user de-authorized the app, the library will throw an UnsuccessfulResponseError. It would be nice if it could detect this already when authorizing and simply set @access_token to nil.
http://github.com/RISCfuture/dropbox/blob/master/lib/dropbox/api.rb#L477
authorize! uses a fake browser to login and authorize. Why does it go through the GUI? Wouldn't it make more sense to use the existing support for basic auth?
What is the reason behind converting all the data to structs? I actually find hashes better because I can encode them back to JSON easily. How about an option for API calls (or some general configuration setting) which would disable the hash to struct conversion?
Hi,
Session#authorize!
doesn't seem to work.
I had a look at it and it appears that login_form.submit
is not working: the page returned is another login page and not the authorization page.
Is this currently being worked on? I'd love to help out.
I'm suddenly getting this error:
2011-01-14T08:40:52-08:00 app[worker.1]: [Worker(host:railgun64.41629 pid:9947)] Doit failed with ArgumentError: convert! has been removed. You must now wrap IOs using:
2011-01-14T08:40:52-08:00 app[worker.1]: UploadIO.new(filename_or_io, content_type, filename=nil)
2011-01-14T08:40:52-08:00 app[worker.1]: Please update your code. - 1 failed attempts
checked in the code, and there is indeed this convert! in the upload method
I have a script that I'm writing to compare files on a webpage with files in my Dropbox. That script is authorized to access my Dropbox account, but I'm unclear how I should use this authorization. The basic example uses this flow:
And that's great the first time, but once your app is authorized the first time, how are you supposed to get authorized the next time? Doing the above every time seems like the wrong way, but I can't figure out how I'm supposed to do this.
How can my script stay authorized or use the fact that its already been authorized once?
Hi people.
For my own proposes I have started to develop a dummy dropbox implementation so I can use it on my tests.
You can check it here:
Just wondering if this could be helpful for some one, and if you want to public the idea on some official place so a more complete implementation could be done.
Regards
f.
hi there,
it's not an issue, but how do you use dropbox gem on cli? I'm getting Dropbox::UnsuccessfulResponseError: HTTP status Net::HTTPForbidden received: http://api.dropbox.com/0/metadata/sandbox?list=true.
I think it has to do with the fact that there is no authorization cookie right?
when using the example from README I get:
`upload': wrong number of arguments (1 for 2) (ArgumentError)
when executing:
session.upload('testfile.txt')
when I change this line to:
session.upload('testfile.txt','/')
I get:
/home/chris/.rvm/gems/ree-1.8.7-2010.02/gems/dropbox-1.2.2/lib/dropbox/api.rb:208:in `upload': HTTP status Net::HTTPForbidden received: http://api-content.dropbox.com/0/files/sandbox (Dropbox::UnsuccessfulResponseError)
just to add that at this point authorization was successful.
thanks,
chris
Because the file read_timeout in bufferedIO is set to 60 by default large files (In my case a 215MB file) cause a timeout in net/http.
Any plans to add support for the new methods in the v1 API?
I have some problems in serializing and deserializing in Sinatra. it would be awesome if you could add a small example for that.
Thanks.
When i try upload file with rails app i get the following error message:
http://pastie.org/1055520
Hello,
I've just a little question, when I was going through the code I noted the method self.check_path. It is used multiple times, but I can't figure out why.
In Dropbox the length of a name is limited to 255 characters, but not the path. And I successfully created
"ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt /
tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt /
tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"
in Dropbox.
But when I use the Dropbox API to get the metadata of this folder I get the error "Dropbox paths are limited to 256 characters in length".
Is this intentional?
Groetjes
Nele
I'm trying to add dropbox in my add.
My guide: http://hafizbadrie.wordpress.com/2011/08/07/ruby-on-rails-connect-to-dropbox-authorization-and-upload/
Baam!! Erro!r!
NameError in DropboxesController#index
uninitialized constant DropboxController::Filebox
how to get over this!!
thanks in advance
Tim,
This is awesome, thanks so much for putting together and maintaining this project. Do you know of a sample rails app available for download that implements the download code and other basic commands?
Thanks again,
Kevin
See:
http://pastie.org/1175809
Let me know if you need more info
Trying to upload a file to my dropbox account I receive a Errno::ENOENT: No such file or directory
ruby-1.9.2-p0 > require 'dropbox'
=> true
ruby-1.9.2-p0 > s = Dropbox::Session.deserialize( File.read( "dropbox_session_authorized.serialized" ) )
=> #<Dropbox::Session xxxxxx (authorized)>
ruby-1.9.2-p0 > s.mode = :dropbox
=> :dropbox
ruby-1.9.2-p0 > s.upload( '/tmp/file1.txt', '/file.txt' )
Errno::ENOENT: No such file or directory - file1.txt
from /Users/fguillen/.rvm/gems/ruby-1.9.2-p0@vitreous/gems/multipart-post-1.0.1/lib/parts.rb:41:in `size'
from /Users/fguillen/.rvm/gems/ruby-1.9.2-p0@vitreous/gems/multipart-post-1.0.1/lib/parts.rb:41:in `initialize'
from /Users/fguillen/.rvm/gems/ruby-1.9.2-p0@vitreous/gems/multipart-post-1.0.1/lib/parts.rb:5:in `new'
from /Users/fguillen/.rvm/gems/ruby-1.9.2-p0@vitreous/gems/multipart-post-1.0.1/lib/parts.rb:5:in `new'
from /Users/fguillen/.rvm/gems/ruby-1.9.2-p0@vitreous/gems/multipart-post-1.0.1/lib/multipartable.rb:6:in `block in initialize'
from /Users/fguillen/.rvm/gems/ruby-1.9.2-p0@vitreous/gems/multipart-post-1.0.1/lib/multipartable.rb:6:in `each'
from /Users/fguillen/.rvm/gems/ruby-1.9.2-p0@vitreous/gems/multipart-post-1.0.1/lib/multipartable.rb:6:in `map'
from /Users/fguillen/.rvm/gems/ruby-1.9.2-p0@vitreous/gems/multipart-post-1.0.1/lib/multipartable.rb:6:in `initialize'
from /Users/fguillen/.rvm/gems/ruby-1.9.2-p0@vitreous/gems/dropbox-1.2.3/lib/dropbox/api.rb:200:in `new'
from /Users/fguillen/.rvm/gems/ruby-1.9.2-p0@vitreous/gems/dropbox-1.2.3/lib/dropbox/api.rb:200:in `upload'
from (irb):18
from /Users/fguillen/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `<main>'
ruby-1.9.2-p0 > File.read( '/tmp/file1.txt' )
=> "file1"
Thanks a lot for the support.
I'm plugging in this great gem with our existing app. It uses oauth-plugin for integrating with other oauth sites besides dropbox. The whole authentication bit is provided by oauth-plugin.
Can API be added so that if I already have a user token and secret, I can manually add it to the session? Is this already possible? I've looked through the code but nothing jumps out at me.
Gemfile contains a dependency on rspec 2, but it's not grouped, so:
Bundler could not find compatible versions for gem "rspec":
In Gemfile:
dropbox depends on
rspec (>= 2.0)
rspec (1.3.1)
hellow every one,,
i m new to iphone and dropbox as well
i want move a file from my device(i.e directory @"/users") to my public folder of dropbox
how it can be possible
which methods should i implement for moving a pdf file
i m trying this
[[self restClient ] moveFrom:documentsDirectory toPath:@"/public"];
Hi,
I am trying to use the user/password route via the authorize! method but it does not seem to be getting past the login - get redirected back, even though I can see the correct details being sent (using Charles).
I guess its not the Dropbox preferred route these days :(
Thanks,
Chris
I'm trying to use the #link method, but the generated link is not working because of the current mode inserted in it. If I remove it it works.
Please note that I've just discovered your plugin today, and did not have a lot of time to work on it so maybe I miss something important.
Thanks :)
Hello.
I have been playing with thumbnail support in Dropbox. It is not (or does not appear to be) in rdropbox. https://www.dropbox.com/developers/docs#thumbnails
The difficulty is the note:
"The thumbnails API call is served by the api-content subdomain unlike most calls which are served by the api subdomain. "
So, first the question: would you be interested in a pull request that adds thumbnail support at all?
And if so, how would you prefer the details to be handled?
I am not very experienced ruby developer, so please don't expect a merge-and-go solution from me :)
Bèr
From your latest release:
/home/pi/.rvm/gems/ruby-2.0.0-p247/gems/oauth-0.4.7/lib/oauth/consumer.rb:216:in `token_request': 400 Bad Request (OAuth::Unauthorized)
from /home/pi/.rvm/gems/ruby-2.0.0-p247/gems/oauth-0.4.7/lib/oauth/consumer.rb:136:in `get_request_token'
from /home/pi/.rvm/gems/ruby-2.0.0-p247/gems/dropbox-1.3.0/lib/dropbox/session.rb:70:in `initialize'
from sync.rb:7:in `new'
from sync.rb:7:in `<main>'
In the tutorial by example, the code listed:
session.upload('testfile.txt')
uploaded_file = session.file('testfile.txt', '/')
Being new to this gem, I think the two command parameters are swapped and should be:
session.upload('testfile.txt', '/')
uploaded_file = session.file('/testfile.txt')
Thanks!
Per the Dropbox API:
Use the hash parameter to metadata with the last hash you had so that you can get a shorter
list. What this does is give you a 304 if hash matches, and the contents again if the hash is
different from what we have.
Unfortunately, it doesn't appear that this gem supports that functionality. It looks like support was started, but the relevant line that hands the :hash
option on in Dropbox::API#metadata
is commented out:
#args.last[:hash] = options[:hash] if options[:hash]
I'm curious why this is the case. I don't want to have to loop through all of the files in the directory to determine which have changed when the hash is different if I can avoid doing so. I suspect it has something to do with handling that 304 status or avoiding unexpected behavior in regards to deleted files (which apparently don't affect the hash returned in metadata calls to the Dropbox API).
hellow every body
i m facing the following issue
.
.
[WARNING] DropboxSDK: error making request to /1/files_put/dropbox/view.pdf - Authentication failed
2012-10-11 15:37:55.640 FastCase[638:207] File upload failed with error - Error Domain=dropbox.com Code=401 "The operation couldn’t be completed. (dropbox.com error 401.)" UserInfo=0xd42c040 {error=Authentication failed, destinationPath=/view.pdf, sourcePath=/Users/svp/Library/Application Support/iPhone Simulator/4.2/Applications/5DD0B9F3-B873-4844-9FDF-69AEAB5DF3F7/Documents/view.pdf}
any body help plzzzz
thx in advance
We perform the update Gem to meet new mandatory standards adopted by Dropbox.
See below for official information from the Dropbox:
Turning off Core API version 0 on Wednesday, May 1st, 2013
We first announced our plans to turn off version 0 of the Dropbox API back in August of 2012. As a reminder, here was our version 0 timeline:
October 11, 2011 - Announced version 1 of the Core API, deprecating version 0.
August 17, 2012 - Announced version 0 turn off date of December 1, 2012.
December 1, 2012 - Extended to March 4, 2013 to give developers more time to migrate and users time to upgrade their apps if necessary.
March 4, 2013 - Restricted access to version 0 to existing users. No new users will be able to link to apps using version 0 of the API.
May 1, 2013 - Turn off Core API version 0.
On Wednesday this week, we’ll finally complete the deprecation process and turn off version 0 for all users.
If you’re a developer that still hasn’t moved to version 1 of the Core API, see our migration guide. For any other questions, visit the developer forum.
My app was working and then suddenly I get this error:
HTTP status Net::HTTPUnauthorized received: http://api-content.dropbox.com/0/files/dropbox/MyFolder
on the upload metod.
my dropbox_session is in :dropbox mode (as you can see from the url)
App status Production (Disable App)
Access type Full Dropbox
using dropbox (current master, latest commit: c752471) with:
Ruby 1.8.7 (2009-06-12 patchlevel 174)
Rails 3.0.6
I get the following error when I use a deserialized session object for listing entries:
HTTP status Net::HTTPBadRequest received: http://api.dropbox.com/0/metadata/sandbox?list=true
My code handling the session initialization, serialization and deserialization looks like this:
def dropbox_session
if session[:dropbox_session]
d_session = Dropbox::Session.deserialize(session[:dropbox_session])
d_session.authorized! unless d_session.authorized?
puts d_session.inspect
d_session
else
d_session = Dropbox::Session.new('#########', '###########',
{:authorizing_user => "###########", :authorizing_password => "#####"})
d_session.mode = :dropbox
d_session.authorize!
session[:dropbox_session] = d_session.serialize
d_session
end
end
It works fine if I create new session every time I need.
Thanks for your help very much!
>> @session = Dropbox::Session.deserialize("xxxxxxxxxx")
=> #<Dropbox::Session xxxxxxxxxx (authorized)>
>> @session.authorized?
=> true
>> @session.list('/')
Dropbox::UnsuccessfulResponseError: HTTP status Net::HTTPUnauthorized received: http://api.dropbox.com/0/metadata/sandbox?list=true
from /Library/Ruby/Gems/1.8/gems/dropbox-1.1.0/lib/dropbox/api.rb:477:in `api_internal'
from /Library/Ruby/Gems/1.8/gems/dropbox-1.1.0/lib/dropbox/api.rb:483:in `api_json'
from /Library/Ruby/Gems/1.8/gems/dropbox-1.1.0/lib/dropbox/api.rb:467:in `get'
from /Library/Ruby/Gems/1.8/gems/dropbox-1.1.0/lib/dropbox/api.rb:393:in `metadata_without_memo'
from /Library/Ruby/Gems/1.8/gems/dropbox-1.1.0/lib/dropbox/memoization.rb:90:in `send'
from /Library/Ruby/Gems/1.8/gems/dropbox-1.1.0/lib/dropbox/memoization.rb:90:in `metadata_with_memo'
from /Library/Ruby/Gems/1.8/gems/dropbox-1.1.0/lib/dropbox/api.rb:419:in `metadata'
from /Library/Ruby/Gems/1.8/gems/dropbox-1.1.0/lib/dropbox/api.rb:419:in `list'
from (irb):3
This gem:
Modifies core objects, including Object, Module, String, Hash, etc. completely unnecessarily. This should be using functional methods and leave the rest of my code alone.
Those modifications in non-namespaced files, such as 'extensions/object.rb', so that any other gem that does a similarly stupid think (namely faker) conflicts and causes issues. They shoudl be in 'dropbox/extensions/object.rb'
The gem seems to depend on methods similarly monkey-patched that are not defined in the gem, namely sub! in api.rb.
Right now this gem is not usable for me.
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.