[ANN] Dropbox client in public repo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] Dropbox client in public repo

cdavidshaffer
I translated the Dropbox (http://dropbox.com) python client to
Smalltalk.  This is a rough translation but works well enough for my
purposes.  It is available in the public store repository under the
bundle name Dropbox.  Here is the bundle comment:

Client for Dropbox.  Mimics the python SDK provided by Dropbox.

You will need to register an "application" with dropbox.  That will get
you a consumer-key and a consumer-key-secret used by this client.
Please read the dropbox developers docs for details
(https://www.dropbox.com/developers).

Note: I did not try to mimic the exception code from Python so right
now, when things go wrong they may throw odd exceptions.  I plan to deal
with this when it hurts me.

Registering CERTS
----------------------

The python SDK included a trusted-certs.crt file which I have pasted
onto the end of this comment.  While the SSL validation doesn't seem to
be working yet, in principle you'd need to do something like:

pem := 'trusted-certs.crt' asFilename.
bundle := CertificateFileReader new readFrom: pem readStream.
X509Registry trustedCertificates addAll: bundle.

to register these certificates.

Using the client
------------------

Here's a sample script which shows usage of the client (all of the
on:do: stuff reflects that fact that the certs are failing to validate
in VisualWorks):

session := DropboxSession
        consumerKey: 'your-consumer-key'
        consumerSecret: 'your-consumer-key-secret'
        accessType: 'app_folder'
        locale: nil .
[rt := session obtainRequestToken.
url := session buildAuthorizeUrlRequestToken: rt callback: nil.
self halt: 'Authenticate at: ' , url, ' then press proceed.'.
session obtainAccessToken.
client := DropboxClient session: session client: RESTClient new] on:
SSLWarning do: [:ex | ex resume].

"sample request"
[client accountInfo] on: SSLWarning do: [:ex | ex resume]

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Dropbox client in public repo

cdavidshaffer
...replying to my own post :-(

Thanks to Boris Popov, the SSL problems have been resolved.  The dropbox
bundle comment has been modified to reflect this.

If you're using the Dropbox client, feel free to post fixes and
improvements.  You'll see that several of the methods are marked (self
halt: 'untested') so I'd be happy to remove that mark once you've found
a use for them.

David

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Dropbox client in public repo

Eliot Miranda-2
In reply to this post by cdavidshaffer
Hi David,

    I was recently directed to http://lists.squeakfoundation.org/pipermail/squeak-dev/2005-August/093575.html.  Do you still have your code available?  If so, can I have it please?  Pant, pant.

On Fri, Jun 8, 2012 at 11:38 AM, C. David Shaffer <[hidden email]> wrote:
I translated the Dropbox (http://dropbox.com) python client to
Smalltalk.  This is a rough translation but works well enough for my
purposes.  It is available in the public store repository under the
bundle name Dropbox.  Here is the bundle comment:

Client for Dropbox.  Mimics the python SDK provided by Dropbox.

You will need to register an "application" with dropbox.  That will get
you a consumer-key and a consumer-key-secret used by this client.
Please read the dropbox developers docs for details
(https://www.dropbox.com/developers).

Note: I did not try to mimic the exception code from Python so right
now, when things go wrong they may throw odd exceptions.  I plan to deal
with this when it hurts me.

Registering CERTS
----------------------

The python SDK included a trusted-certs.crt file which I have pasted
onto the end of this comment.  While the SSL validation doesn't seem to
be working yet, in principle you'd need to do something like:

pem := 'trusted-certs.crt' asFilename.
bundle := CertificateFileReader new readFrom: pem readStream.
X509Registry trustedCertificates addAll: bundle.

to register these certificates.

Using the client
------------------

Here's a sample script which shows usage of the client (all of the
on:do: stuff reflects that fact that the certs are failing to validate
in VisualWorks):

session := DropboxSession
        consumerKey: 'your-consumer-key'
        consumerSecret: 'your-consumer-key-secret'
        accessType: 'app_folder'
        locale: nil .
[rt := session obtainRequestToken.
url := session buildAuthorizeUrlRequestToken: rt callback: nil.
self halt: 'Authenticate at: ' , url, ' then press proceed.'.
session obtainAccessToken.
client := DropboxClient session: session client: RESTClient new] on:
SSLWarning do: [:ex | ex resume].

"sample request"
[client accountInfo] on: SSLWarning do: [:ex | ex resume]

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



--
best,
Eliot

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Dropbox client in public repo

Eliot Miranda-2
Hi David,

    oops!  It seems you didn't write the code in question, but did hit the problem it solved.  Forgive the intrusion.  I need to follow up on http://lists.squeakfoundation.org/pipermail/squeak-dev/2003-May/057750.html

On Tue, Oct 14, 2014 at 8:56 AM, Eliot Miranda <[hidden email]> wrote:
Hi David,

    I was recently directed to http://lists.squeakfoundation.org/pipermail/squeak-dev/2005-August/093575.html.  Do you still have your code available?  If so, can I have it please?  Pant, pant.

On Fri, Jun 8, 2012 at 11:38 AM, C. David Shaffer <[hidden email]> wrote:
I translated the Dropbox (http://dropbox.com) python client to
Smalltalk.  This is a rough translation but works well enough for my
purposes.  It is available in the public store repository under the
bundle name Dropbox.  Here is the bundle comment:

Client for Dropbox.  Mimics the python SDK provided by Dropbox.

You will need to register an "application" with dropbox.  That will get
you a consumer-key and a consumer-key-secret used by this client.
Please read the dropbox developers docs for details
(https://www.dropbox.com/developers).

Note: I did not try to mimic the exception code from Python so right
now, when things go wrong they may throw odd exceptions.  I plan to deal
with this when it hurts me.

Registering CERTS
----------------------

The python SDK included a trusted-certs.crt file which I have pasted
onto the end of this comment.  While the SSL validation doesn't seem to
be working yet, in principle you'd need to do something like:

pem := 'trusted-certs.crt' asFilename.
bundle := CertificateFileReader new readFrom: pem readStream.
X509Registry trustedCertificates addAll: bundle.

to register these certificates.

Using the client
------------------

Here's a sample script which shows usage of the client (all of the
on:do: stuff reflects that fact that the certs are failing to validate
in VisualWorks):

session := DropboxSession
        consumerKey: 'your-consumer-key'
        consumerSecret: 'your-consumer-key-secret'
        accessType: 'app_folder'
        locale: nil .
[rt := session obtainRequestToken.
url := session buildAuthorizeUrlRequestToken: rt callback: nil.
self halt: 'Authenticate at: ' , url, ' then press proceed.'.
session obtainAccessToken.
client := DropboxClient session: session client: RESTClient new] on:
SSLWarning do: [:ex | ex resume].

"sample request"
[client accountInfo] on: SSLWarning do: [:ex | ex resume]

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



--
best,
Eliot



--
best,
Eliot

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc