{ "info": { "author": "Cyril Panshine", "author_email": "kipanshi@gmail.com", "bugtrack_url": null, "classifiers": [ "Framework :: Pyramid", "Programming Language :: Python", "Programming Language :: Python :: 2", "Topic :: Internet :: WWW/HTTP" ], "description": "==============\npyramid_upwork\n==============\n\n``pyramid_upwork`` allows your users to authorize via `upwork`_\non your `pyramid`_ project.\n\nYou can find it on `pypi`_ as ``pyramid_upwork``. Also don't forget to check the `documentation`_.\n\n.. _`upwork`: https://upwork.com/\n.. _`pyramid`: http://www.pylonsproject.org/\n.. _`pypi`: http://pypi.python.org/pypi/pyramid_upwork\n.. _`documentation`: http://pythonhosted.org/pyramid_upwork/\n\n\nRequirements\n------------\n`pyramid-redis-sessions`_ is used to store session in `Redis`_ database, so you need to install\n`Redis`_ and configure it to listen to port ``127.0.0.1``.\n\nOther packages are installed automatically::\n\n pyramid\n pyramid_redis_sessions\n python-upwork\n\nTo activate ``jinja2`` renderer, install::\n\n pip install pyramid_jinja2\n\n.. _`pyramid-redis-sessions`: https://github.com/ericrasmussen/pyramid_redis_sessions\n.. _`Redis`: http://redis.io/\n\n\nInstallation\n------------\nInstall with pip::\n\n pip install pyramid_upwork\n\nor using ``easy_install``::\n\n easy_install pyramid_upwork\n\nYou need to create `Upwork API keys`_ of the type ``Web`` and set appropriate permissions to the generated API key.\n\n.. _`Upwork API keys`: https://www.upwork.com/services/api/keys\n\n\nUsage\n-----\nYou can take a look at the `pyramid_upwork_example`_ application or use\nthe instructions below.\n\nInclude following settings in your ``*.ini`` file::\n\n [app:main]\n\n ...\n\n # Redis session settings\n redis.sessions.secret = FILL ME\n\n # upwork settings\n upwork.api.key = FILL ME\n upwork.api.secret = FILL ME\n\nThen in your project's ``__init__.py`` define the following function::\n\n def get_acl_group(user_uid, request):\n \"\"\"Here goes your ACL logic.\"\"\"\n # All authenticated users have ``view`` permission\n return 'view'\n\nThis function should return list of ACL group `principals`_ or None if user\nis not allowed to have any access groups. See pyramid documentation for `security`_ and `tutorial`_.\n\nDefine a RootFactory in your ``models.py``::\n\n class RootFactory(object):\n \"\"\"This object sets the security for our application.\"\"\"\n __acl__ = [\n (Allow, Authenticated, 'view'),\n (Deny, Authenticated, 'login'),\n (Allow, Everyone, 'login'),\n ]\n\n def __init__(self, request):\n pass\n\nNow register ``get_acl_group()`` function in the config registry to make authorization work. Put in your main method::\n\n def get_acl_group(request):\n return ('view',)\n\n def main(global_config, **settings):\n \"\"\"Main app configuration binding.\"\"\"\n\n config = Configurator(settings=settings,\n root_factory=\"myapp.models.RootFactory\")\n\n # ACL authorization callback for pyramid-upwork\n config.registry.get_acl_group = get_acl_group\n\n # External includes\n config.include('pyramid_upwork')\n\n # Views and routing goes here\n # ...\n #\n config.add_view('myapp.views.MainPage',\n renderer='templates/main.jinja2',\n permission='view')\n\n return config.make_wsgi_app()\n\n.. _`principals`: http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/glossary.html#term-principal\n.. _`security`: http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/security.html\n.. _`tutorial`: http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/tutorials/wiki2/authorization.html\n.. _`pyramid_upwork_example`: https://github.com/kipanshi/pyramid_upwork_example\n\nYou can provide custom ``forbidden.jinja2`` template by overriding asset in your ``__init__.py``::\n\n # Override forbidden template config.override_asset(\n to_override='pyramid_upwork:templates/forbidden.jinja2',\n override_with='myapp:templates/forbidden.jinja2')\n\nSee template example in `pyramid_upwork/templates/forbidden.jinja2`_.\n\nThe \"Logout\" action is done also via POST request with CSRF protection,\nsee example of \"Logout\" buttion in `pyramid_upwork_example/templates/layout.jinja2`_.\n\n.. _`pyramid_upwork/templates/forbidden.jinja2`: https://github.com/kipanshi/pyramid_upwork/tree/master/pyramid_upwork/templates/forbidden.jinja2\n.. _`pyramid_upwork_example/templates/layout.jinja2`: https://github.com/kipanshi/pyramid_upwork_example/blob/master/pyramid_upwork_example/templates/layout.jinja2\n\n\nContacts\n--------\nThe project is made by Cyril Panshine (`@CyrilPanshine`_). Bug reports and pull requests are very much welcomed!\n\n.. _`@CyrilPanshine`: https://twitter.com/CyrilPanshine\n\n\n1.1.6\n-----\nOdesk rebranded to Upwork, now using python-upwork library.\n\n1.1.5\n-----\n- Due to oDesk Public API change we need to get user information now from\n ``client.hr.get_user_me()``\n\n1.1.4\n-----\n- Implement bugfix for case when session is broken and\n request token and secret are not set.\n\n1.1.3\n-----\n- Store first and last name in the session for further usage in templates\n\n1.1.2\n-----\n- Login and Logout actions are performed via POST and has protection\n against CSRF attacks\n\n1.1.1\n-----\n- Fix ``BaseHandler`` obscuring ``AttributeError`` during dispatch\n\n1.1\n---\n- Use ``override_offset`` for overriding ``forbidden.jinja2`` template.\n- If user is authenticated but is not authrized for some view,\n render ``forbidden`` page with **Log out** link instead of redirect\n to avoid redirect loop\n\n1.0\n---\n- Initial version.", "description_content_type": null, "docs_url": "https://pythonhosted.org/pyramid_upwork/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kipanshi/pyramid_upwork", "keywords": "web pyramid pylons authentication upwork oauth", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pyramid_upwork", "package_url": "https://pypi.org/project/pyramid_upwork/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyramid_upwork/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/kipanshi/pyramid_upwork" }, "release_url": "https://pypi.org/project/pyramid_upwork/1.1.6/", "requires_dist": null, "requires_python": null, "summary": "pyramid_upwork", "version": "1.1.6" }, "last_serial": 1593741, "releases": { "1.1.6": [ { "comment_text": "", "digests": { "md5": "e7d4908eccad474bb8f0e51ba5091479", "sha256": "de5a0d430357604429e70b0b234318362d07f8d620c1bd6f4022af70693872e1" }, "downloads": -1, "filename": "pyramid_upwork-1.1.6.tar.gz", "has_sig": false, "md5_digest": "e7d4908eccad474bb8f0e51ba5091479", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6441, "upload_time": "2015-06-16T04:28:54", "url": "https://files.pythonhosted.org/packages/66/f7/c1597e47c12e8b4d5c3f9937098327bd4a8f15a9186c566040dc8a2f8ec3/pyramid_upwork-1.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e7d4908eccad474bb8f0e51ba5091479", "sha256": "de5a0d430357604429e70b0b234318362d07f8d620c1bd6f4022af70693872e1" }, "downloads": -1, "filename": "pyramid_upwork-1.1.6.tar.gz", "has_sig": false, "md5_digest": "e7d4908eccad474bb8f0e51ba5091479", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6441, "upload_time": "2015-06-16T04:28:54", "url": "https://files.pythonhosted.org/packages/66/f7/c1597e47c12e8b4d5c3f9937098327bd4a8f15a9186c566040dc8a2f8ec3/pyramid_upwork-1.1.6.tar.gz" } ] }