Post

1 follower Follow
0
Avatar

Python client up-to-date? Getting error calling Hook.validate()

Hi all,

can somebody verify that the official python client at https://github.com/podio/podio-py is working? I managed to setup a webhook via the API and Podio is calling my URL to verify; but when I try to respond using Hook.validate() -- using correct the hook-id and code, of course -- I get the following exception from podiopy2/transport.py:

TransportException({'status': '404', 'content-length': '513', 'via': 'HTTP/1.1 GWA', 'x-google-cache-control': 'remote-fetch', 'connection': 'keep-alive', 'server': 'nginx/1.0.14', 'reason': 'Not Found', 'date': 'Fri, 14 Dec 2012 18:09:52 GMT', 'content-type': 'application/json; charset=utf-8', 'x-podio-request-id': '0'}): {"error_propagate":false,"error_parameters":{},"error_detail":null,"error_description":"No matching operation could be found. No body was given.","error":"not_found"}

Traceback (most recent call last):

File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__

rv = self.handle_exception(request, response, e)

File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__

rv = self.router.dispatch(request, response)

File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher

return route.handler_adapter(request, response)

File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__

return handler.dispatch()

File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch

return self.handle_exception(e, self.app.debug)

File "/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch

return method(*args, **kwargs)

File "/base/data/home/apps/s~workflodio/1.363866542887888607/podiohook.py", line 162, in post

runtyp

File "/base/data/home/apps/s~workflodio/1.363866542887888607/podiohook.py", line 90, in verify_hook

result = self.client.Hook.validate(hook_id, code)

File "/base/data/home/apps/s~workflodio/1.363866542887888607/podio/pypodio2/areas.py", line 258, in validate

code=code)

File "/base/data/home/apps/s~workflodio/1.363866542887888607/podio/pypodio2/transport.py", line 141, in __call__

return handler(response, data)

File "/base/data/home/apps/s~workflodio/1.363866542887888607/podio/pypodio2/transport.py", line 209, in _handle_response

raise TransportException(response, data)

TransportException: TransportException({'status': '404', 'content-length': '513', 'via': 'HTTP/1.1 GWA', 'x-google-cache-control': 'remote-fetch', 'connection': 'keep-alive', 'server': 'nginx/1.0.14', 'reason': 'Not Found', 'date': 'Fri, 14 Dec 2012 18:09:52 GMT', 'content-type': 'application/json; charset=utf-8', 'x-podio-request-id': '0'}): {"error_propagate":false,"error_parameters":{},"error_detail":null,"error_description":"No matching operation could be found. No body was given.","error":"not_found"}

I don't think the problem is on my side. However, I am on Google App Engine and don't know how to find the raw http. Anybody having the same problem?

Best,

Stefan

Stefan Ukena

Please sign in to leave a comment.

5 comments

0
Avatar

Ok, so I will answer my own question: podio-py is not up-to-date, or at least it is not working with the current app engine sdk (1.7.x). In case anybody else runs into the same problem: transport.py isn't encoding the POST payload the way podio expects it. Here is what I ended up changing (starting at line 123):

if (self._method == "POST" or self._method == "PUT") and 'type' not in kwargs:

headers.update(

  # was: {'content-type':'application/x-www-form-urlencoded'})

  {'content-type':'application/json'})

  # was: body = self._generate_body()

  # Not sure if this will always work, but for validate/verfiy nothing else was working:

  body = json.dumps(kwargs)

Best,

Stefan

P.S.: Can somebody please fix the default sort-order of the dev-forum to "most recent first" (instead of  "highest voted first").

Stefan Ukena 0 votes
Comment actions Permalink
0
Avatar

The Python client is not much used and we currently don't have the resources to maintain it. That doesn't mean we have abandoned it, but it is lagging a bit behind.

It would be a great help if you would submit your fix as a pull request on Github.

PS: This link will show posts with most recent first: https://help.podio.com/forums/21007072#recent

Casper Fabricius 0 votes
Comment actions Permalink
0
Avatar

Hi Casper,

thanks for the reply, will do that!

Best,

Stefan

Stefan Ukena 0 votes
Comment actions Permalink