create model/get pricing for a model without Oauth permissions

Discussion in 'Shapeways API' started by 496143_deleted, Mar 1, 2014.

  1. Does anyone know which resources are protected (and require a login to the native shapeways application)?
    I don't want to have to force users to go through authentication to get a price and use 2 different UIs.

    Mainly, I want the user to use the webapp I'm building and have a seamless experience purchasing a model they have created.
    Shapeways will act to create model files from the .stl's, provide pricing, and support the production/shipping aspect.

    Below is what I am trying to accomplish with my app:
    white label business model: your app/site uploads the order directly to our server. Your customer stays on your site to place the order. You take care of first-line support for your customers if needed.


    Currently I am using Python, and if anyone can point me to some good examples of using the API with this language, would be much appreciated. I have searched Google for hours, but I have had little success.

    Many thanks,

    -C
     
  2. stonysmith
    stonysmith Well-Known Member Moderator
    Do you want the customer to create an item and then order it thru YOUR shop? Or do you want to allow them to push the model into THEIR account?
    That makes a rather large difference in how you go about authorizing access with OAUTH.
     
  3. hey stonysmith, thank you for the example code.
    I have am unfortunately still stuck, and to answer the below questions:

    Do you want the customer to create an item and then order it thru YOUR shop? Yes, that was the plan.

    Currently, I am doing somewhat of a compromise, trying to test via redirect for a user to authenticate via shapeways auth screen.

    My problem more directly outlined below:

    client = Client("key","secret","redirect url")
    url = client.connect()

    -I believe that this part is failing. When i check the url, it is a nonetype.

    Google app engine logging - here is what I'm seeing (I am using the client reference API for python):

    2014-03-08 17:03:42.314

    Encoding URI, headers and body to utf-8.

    I 2014-03-08 17:03:42.315

    Starting new HTTPS connection (1): api.shapeways.com

    D 2014-03-08 17:03:42.543

    "POST /oauth1/request_token/v1 HTTP/1.1" 401 None

    D 2014-03-08 17:03:42.544

    Redirect URL:

    D 2014-03-08 17:03:42.544

    None

    D 2014-03-08 17:03:42.545

    if Nonetype above, authentication request has failed.

    E 2014-03-08 17:03:42.545

    'NoneType' object has no attribute 'startswith'
    Traceback (most recent call last):
    File " /base/data/home/runtimes/python27/python27_lib/versions/thir d_party/webapp2-2.5.2/webapp2.py ", line 1535, in __call__
    rv = self.handle_exception(request, response, e)
    File " /base/data/home/runtimes/python27/python27_lib/versions/thir d_party/webapp2-2.5.2/webapp2.py ", line 1529, in __call__
    rv = self.router.dispatch(request, response)
    File " /base/data/home/runtimes/python27/python27_lib/versions/thir d_party/webapp2-2.5.2/webapp2.py ", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
    File " /base/data/home/runtimes/python27/python27_lib/versions/thir d_party/webapp2-2.5.2/webapp2.py ", line 1102, in __call__
    return handler.dispatch()
    File " /base/data/home/runtimes/python27/python27_lib/versions/thir d_party/webapp2-2.5.2/webapp2.py ", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
    File " /base/data/home/runtimes/python27/python27_lib/versions/thir d_party/webapp2-2.5.2/webapp2.py ", line 570, in dispatch
    return method(*args, **kwargs)
    File " /base/data/home/apps/s~able-marking-491/1.374286795910768956 /main.py ", line 102, in get
    self.redirect(url)
    File " /base/data/home/runtimes/python27/python27_lib/versions/thir d_party/webapp2-2.5.2/webapp2.py ", line 608, in redirect
    response=self.response)
    File " /base/data/home/runtimes/python27/python27_lib/versions/thir d_party/webapp2-2.5.2/webapp2.py ", line 1764, in redirect
    if uri.startswith(('.', '/')):
    AttributeError: 'NoneType' object has no attribute 'startswith'

     
  4. stonysmith
    stonysmith Well-Known Member Moderator
    To me, that would imply that the Redirect URL didn't answer.
     
  5. Thanks, I have come to a similar conclusion. When I use the API in a script outside of Google App Engine, it works fine (using OOB method).
    I am moving my work to Heroku to see whether the platform switch will make the difference. Cheers!