Giter Club home page Giter Club logo

podio-py's Introduction

No Maintenance Intended

PyPodio

Python wrapper for the Podio API.

Install

Dependencies

  • httplib2

PyPodio is not yet available on PyPI, we're waiting to have it a bit more stable. Install by cloning from the GitHub repo:

$ git clone git://github.com/podio/podio-py.git
$ cp -r podio-py/pypodio2 path/to/destination

Alternatively, install via pip:

$ pip install -e git+https://github.com/podio/podio-py.git#egg=podio-py

Example

from pypodio2 import api
from client_settings import *

c = api.OAuthClient(
    client_id,
    client_secret,
    username,
    password,    
)
print c.Item.find(22342)

Notes

It is possible to override the default response handler by passing handler as a keyword argument to a transport function call. For example:

x = lambda x,y: (x,y)
result = c.Item.find(11007, basic=True, handler=x)
($result, $data) #Returned info

Tests

To run tests for the API wrapper, you need two additional dependencies:

  • mock
  • nose

With those installed, run nosetests from the repository's root directory.

Meta

podio-py's People

Contributors

andrecp avatar basiisania avatar cmchase avatar filchambers avatar kwilcox avatar mgerring avatar ojrac avatar petri avatar pulczynski avatar r14c avatar sebgoa avatar splack avatar steuke avatar troelsim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

podio-py's Issues

Release podio-py to Pypi

Your documentation everywhere recommends installing this package directly from GitHub. There is no reason not to release this to Pypi, instead of having a very old release there.

OAuth Doesn't support App Login

Since App login and User login is nearly the same process (except the url parmeters), the API should support it.

right now the url_parameter grant_type is hardcoded to "password". This should be configurable.

Note on dependencies

If you get this error:

init() got an unexpected keyword argument 'disable_ssl_certificate_validation'

then probably caused by old httplib2 library, to fix:

easy_install -U httplib2

AutoRefresh token doesn't happen.

Any operation must be retried with a refreshed token in case the token is expired.

https://help.podio.com/hc/communities/public/questions/200517138-Refresh-Token

  File "/home/ubuntu/accounts-server/src/accounts_server/services/consumer_data_service/podio_customer_app.py", line 26, in get_consumer_by_mobile
    results = self.c.Item.filter(app_id=self.app_id, attributes=attributes)
  File "/home/ubuntu/.virtualenvs/accounts-server/src/pypodio2-master/pypodio2/areas.py", line 102, in filter
    type="application/json", **kwargs)
  File "/home/ubuntu/.virtualenvs/accounts-server/src/pypodio2-master/pypodio2/transport.py", line 146, in __call__
    return handler(response, data)
  File "/home/ubuntu/.virtualenvs/accounts-server/src/pypodio2-master/pypodio2/transport.py", line 216, in _handle_response
    raise TransportException(response, data)
TransportException: TransportException({'status': '401', 'content-length': '234', 'server': 'nginx', 'connection': 'keep-alive', 'x-podio-request-id': 'd3RKoSs6', 'date': 'Mon, 15 Jun 2015 05:15:32 GMT', 'content-type': 'application/json; charset=utf-8', 'www-authenticate': 'Bearer realm="podio", error="expired_token"', 'authorization': 'Bearer realm="podio", error="expired_token"'}): {"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http:\/\/api.podio.com\/item\/app\/xxxxxxx\/filter\/","query_string":"","method":"POST"},"error_description":"expired_token","error":"unauthorized"}

error if silent parameter of update is not True

c.Item.update(user_id, {'fields': fields})
File "/home/davhad/src/podio-py/pypodio2/areas.py", line 72, in update
return self.transport.PUT(url='/item/%d%s' % (item_id, "?silent=true" if silent else ""), body=attributes,
TypeError: %d format: a number is required, not unicode

Support Python 3

More and more libraries do. Would be nice. In general, a good thing (tm) ๐Ÿ‘

SSL error

pypodio2 with httplib2 0.9 (same with 0.8) and Python 3.4 gives me the error below which is related to: https://github.com/jcgregorio/httplib2/issues/173

/home/[username]/[path]/pypodio2/api.py in OAuthAppClient(client_id, client_secret, app_id, app_token, user_agent, domain)
     18 
     19     auth = transport.OAuthAppAuthorization(app_id, app_token,
---> 20     client_id, client_secret, domain)
     21
     22     return AuthorizingClient(domain, auth, user_agent=user_agent)

/home/[username]/[path]/pypodio2/transport.py in __init__(self, app_id, app_token, key, secret, domain)
     60         headers = {'content-type':'application/x-www-form-urlencoded'}
     61         response, data = h.request(domain + "/oauth/token", "POST",
---> 62                                   urlencode(body), headers=headers)
     63         if response['status'] == '200':
     64              self.token = OAuthToken(_handle_response(response, data))

/usr/local/lib/python3.4/dist-packages/httplib2/__init__.py in request(self, uri, method, body, headers, redirections, connection_type)
   1172                                 ca_certs=self.ca_certs,
   1173                                 disable_ssl_certificate_validation=
-> 1174                                         self.disable_ssl_certificate_validation)
   1175                 else:
   1176                     conn = self.connections[conn_key] = connection_type(

/usr/local/lib/python3.4/dist-packages/httplib2/__init__.py in __init__(self, host, port, key_file, cert_file, timeout, proxy_info, ca_certs, disable_ssl_certificate_validation)
    827                 self, host, port=port, key_file=key_file,
    828                 cert_file=cert_file, timeout=timeout, context=context,
--> 829                 check_hostname=True)
    830
    831

/usr/lib/python3.4/http/client.py in __init__(self, host, port, key_file, cert_file, timeout, source_address, context, check_hostname)
   1209                 check_hostname = will_verify
   1210             elif check_hostname and not will_verify:
-> 1211                 raise ValueError("check_hostname needs a SSL context with "
   1212                                  "either CERT_OPTIONAL or CERT_REQUIRED")
   1213             if key_file or cert_file:

ValueError: check_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED

Cannot import urlencode

I installed PyPodio latest from PyPi on Python 3.10.2 and its giving me error:
Import error: Cannot import urlencode from urllib
Its better described on this post on StackOverflow
Import Error
and here's the screenshot of my errors and code.
Screenshot (1)

httplib is not thread safe.

Httplib is not thread safe. A lot of production servers will use a gunicorn/gevent/thread based app servers.
These can cause httplib to have issues when issuing requests to podio which results in podio-py to break.

A better approach could be to use the awesome requests library

Documentation is incorrect

print c.Items.get_item(22342) doesn't work, because the correct function is find(), not get_item().

Also, now that there's a setup.py you should add this installation method to the docs, for people using requirements.txt files:

pip install -e git+git://github.com/podio/podio-py.git#egg=podio-py

Export from apps

I am trying to use the api to export the data from apps.

The Podio API docs show this is possible for Ruby and PHP.

The "Item" object does not have an "Item.export" method. Does this mean it is not implemented?

I have managed to find an "Application.get_items" method that returns a complicated json file with the key-values of the fields buried deep in a heap of other stuff but I want to check that this is the only way before I use time parsing the fields out of that file.

also submitted to Podio developers forum

Unable to install PyPodio via PIP

When I tried to install PyPodio via PIP, I got the following error. Is it an issue or my mistake. I am a newbie to PIP & Linux(my current OS).
The command I ran was :
sudo pip install PyPodio

/usr/bin/pip run on Tue Sep 23 17:23:39 2014
Downloading/unpacking PyPodio
Getting page https://pypi.python.org/simple/PyPodio/
Could not fetch URL https://pypi.python.org/simple/PyPodio/: 404 Client Error: Not Found
Will skip URL https://pypi.python.org/simple/PyPodio/ when looking for download links for PyPodio
Getting page https://pypi.python.org/simple/
URLs to search for versions for PyPodio:

  • https://pypi.python.org/simple/PyPodio/
    Getting page https://pypi.python.org/simple/PyPodio/
    Could not fetch URL https://pypi.python.org/simple/PyPodio/: 404 Client Error: Not Found
    Will skip URL https://pypi.python.org/simple/PyPodio/ when looking for download links for PyPodio
    Could not find any downloads that satisfy the requirement PyPodio
    Cleaning up...
    Removing temporary dir /tmp/pip_build_root...
    No distributions at all found for PyPodio
    Exception information:
    Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
    File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
    File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1177, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
    File "/usr/lib/python2.7/dist-packages/pip/index.py", line 277, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
    DistributionNotFound: No distributions at all found for PyPodio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.