[Iplant-api-dev] Agave SDK for Python

Darren Boss dboss at email.arizona.edu
Sun Feb 2 07:10:38 MST 2014


Any progress in fixing the authorization problem in the Python SDK? I
just tried to pull from the git repo but I'm still up to date.

On Wed, Jan 29, 2014 at 5:31 PM, Rion Dooley <dooley at tacc.utexas.edu> wrote:
> If you're walking a client-side flow from the web, the settings would be:
>
> agave = OAuth2Service(
>    client_id= <Consumer Secret from api store>,
>    client_secret=<Consumer Key from api store>,
>    name='agave',
>    authorize_url='https://agave.iplantc.org/oauth2/authorize',
>    access_token_url='https://agave.iplantc.org/oauth2/token',
>    base_url='https://agave.iplantc.org')
>
> If your application is not a webapp, you can use the user credential flow,
> which is the HTTP Basic call that you posted before and that the CLI uses to
> obtain a token.
>
> --
> Rion
>
>
>
>
> On Jan 29, 2014, at 4:06 PM, Darren Boss <dboss at email.arizona.edu> wrote:
>
> I'm new to OAuth as well. I'm using the rauth module and I'm confused
> about the urls I should plug into the code. The basic example for
> twitter looks like this:
>
> from rauth import OAuth1Service
>
> # Get a real consumer key & secret from https://dev.twitter.com/apps/new
> twitter = OAuth1Service(
>    name='twitter',
>    consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',
>    consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',
>    request_token_url='https://api.twitter.com/oauth/request_token',
>    access_token_url='https://api.twitter.com/oauth/access_token',
>    authorize_url='https://api.twitter.com/oauth/authorize',
>    base_url='https://api.twitter.com/1.1/')
>
> What would I set name, request_token_url, access_token_url,
> authorize_url and base_url to. I know some of these will be a guess
> for you for when I use https://agave.iplantc.org/token for the urls
> the response I get back is :
>
> {"fault":{"code":"403","type":"Status report","message":"Runtime
> Error","description":"No matching resource found in the API for the
> given request"}}
>
> I am putting in the appropriate consumer_key and secret from my
> subscription page.
>
> There is also an OAuth2Serivce class in the module as well.
>
> On Mon, Jan 27, 2014 at 10:55 AM, Joe Stubbs <jstubbs at tacc.utexas.edu>
> wrote:
>
> There is an issue in the SDK. It's not setting the Authorization header
> correctly. It's using the apiKey on the ApiClient instance to set a
> header called 'Api_key', but it needs to set the Auth header with value
> in the format "Bearer <token>". We'll look into getting a fix in the
> repo soon.
>
> We're sorry for the frustration.
>
> Joe
>
>
> On 01/24/2014 11:23 PM, Rion Dooley wrote:
>
> I'll ask our python guru to check it out. The SDK is for Python 2.
>
> Rion
> ________________________________________
> From: Darren Boss [dboss at email.arizona.edu]
> Sent: Friday, January 24, 2014 11:15 PM
> To: Rion Dooley
> Cc: Discussion of iPlant API development
> Subject: Re: [Iplant-api-dev] Agave SDK for Python
>
> Here is the code that I assumed would get me a list of apps but I'm
> only getting an exception (HTTP Error 500). I'm able to get the app
> list using the curl command  "curl -sk -H "Authorization: Bearer
> ea8e39f649ddfb89d5a13a629d4f51" https://agave.iplantc.org/apps/2.0". I
> also renamed the agave-sdk-python to agave otherwise I can't import it
> (modules with hyphens in Python are problematic):
>
> from agave import *
>
> apiClient = agave.ApiClient('ea8e39f649ddfb89d5a13a629d4f51',
> 'https://agave.iplantc.org/')
> appsService = AppsApi.AppsApi(apiClient)
> response = appsService.listApplication()
>
> Has someone tested the generated Python Api to make sure it works and
> with what version of Python?
>
> On Fri, Jan 24, 2014 at 12:57 PM, Darren Boss <dboss at email.arizona.edu>
> wrote:
>
> Cool, that's what I was starting to think. I'll take a look at using
> rauth together with the sdk. I'll probably email back with more
> questions shortly.
>
> On Fri, Jan 24, 2014 at 12:45 PM, Rion Dooley <dooley at tacc.utexas.edu>
> wrote:
>
> The process for obtaining a token is intentionally left out. Agave uses
> OAuth2 and there are quite a few open source libraries in multiple languages
> that handle that interaction for you. Rather than reinvent the wheel, we
> leave it to you to use whichever library and oauth flow suites your needs.
>
> If you just need to get a token quickly to kick things around, you can go to
> http://agaveapi.co/live-docs and click the login button. It will walk the
> oauth flow for you and put a token in the input box next to the button. That
> is also a good example of how you could add a "login with iPlant" feature to
> a website.
>
> Rion
>
> ________________________________________
> From: iplant-api-dev-bounces at iplantcollaborative.org
> [iplant-api-dev-bounces at iplantcollaborative.org] on behalf of Darren Boss
> [dboss at email.arizona.edu]
> Sent: Friday, January 24, 2014 11:27 AM
> To: Rion Dooley
> Cc: Discussion of iPlant API development
> Subject: [Iplant-api-dev] Agave SDK for Python
>
> I recently checked out the api for Python from
> https://bitbucket.org/taccaci/agave-sdk-python. I have a question
> about using the api in a Python project. It appears there is nothing
> in the api for dealing with tokens and the one example just has the
> token listed in a variable (the code sample for that is actually
> Perl). Has anyone used the python sdk yet? I'm just trying to use it
> in ipython right now. Do I need to create my own classes for dealing
> with tokens?
>
> If anyone else gives it a try make sure to rename the checked out
> directory so there are no hyphens otherwise you can't use it in an
> import statement.
>
> Any calls that hit the server are just returning error 500.
> _______________________________________________
> Iplant-api-dev Mailing List: Iplant-api-dev at iplantcollaborative.org
> List Info and Archives:
> http://mail.iplantcollaborative.org/mailman/listinfo/iplant-api-dev
> One-click Unsubscribe:
> http://mail.iplantcollaborative.org/mailman/options/iplant-api-dev/dooley%40tacc.utexas.edu?unsub=1&unsubconfirm=1
>
> _______________________________________________
> Iplant-api-dev Mailing List: Iplant-api-dev at iplantcollaborative.org
> List Info and Archives:
> http://mail.iplantcollaborative.org/mailman/listinfo/iplant-api-dev
> One-click Unsubscribe:
> http://mail.iplantcollaborative.org/mailman/options/iplant-api-dev/jstubbs%40tacc.utexas.edu?unsub=1&unsubconfirm=1
>
>
> _______________________________________________
> Iplant-api-dev Mailing List: Iplant-api-dev at iplantcollaborative.org
> List Info and Archives:
> http://mail.iplantcollaborative.org/mailman/listinfo/iplant-api-dev
> One-click Unsubscribe:
> http://mail.iplantcollaborative.org/mailman/options/iplant-api-dev/dboss%40email.arizona.edu?unsub=1&unsubconfirm=1
>
>
> _______________________________________________
> Iplant-api-dev Mailing List: Iplant-api-dev at iplantcollaborative.org
> List Info and Archives:
> http://mail.iplantcollaborative.org/mailman/listinfo/iplant-api-dev
> One-click Unsubscribe:
> http://mail.iplantcollaborative.org/mailman/options/iplant-api-dev/dooley%40tacc.utexas.edu?unsub=1&unsubconfirm=1
>
>


More information about the Iplant-api-dev mailing list