{ "info": { "author": "Volodymyr Hotsyk, Anton Strogonoff", "author_email": "gotsyk@gmail.com, astrogov@upwork.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "============\nFlask-Upwork\n============\n\nRequirements\n============\n\n * `flask`\n * `python-upwork`\n * `python-oauth2`\n\n\nAuthorization\n==============\n\nQuick start\n-----------\n\nBefore you may use Upwork APIs, you will need to obtain your pair of API keys.\nVisit the `Upwork API Center documentation `_\nfor full details. Please note, that Flask-Upwork uses authorization via OAuth and it needs keys with auth type \"OAuth\".\n\nPlease make sure, that `SECRET_KEY` which is necessary for sessions, based on the secure cookies, is indicated in `settings.py`:: \n\n SECRET_KEY = '(your random secret key)'\n\nYou need to store your pair of Upwork API keys in `settings.py`::\n\n ODESK_KEY = '(your Upwork public key)'\n ODESK_SECRET = '(your Upwork secret key)'\n\nYou can also set the list of teams in `settings.py`, which will be able to authorize.\nIf you do not specify this option or leave the list empty, then all Upwork users will be able to authorize::\n\n\n ODESK_AUTH_TEAMS = ('teamname',)\n\nPlease make sure that you have registered Upwork module in your `app.py` correctly.\nPlease keep in mind that `url_prefix` can be whatever you like::\n\n from flask import Flask\n from flaskext.odesk import odesk\n\n app = Flask(__name__)\n app.config.from_pyfile('settings.py')\n app.register_module(odesk, url_prefix='/odesk')\n\n\n\nUsing authorization\n-------------------\n\nPlease use the decorator `login_required` to close the access for anonymous users to the certain parts of your website::\n\n @app.route('/only/for/odesk/users')\n @odesk.login_required\n def admin():\n return \"Welcome, Upwork user!\"\n\nIf you want to indicate login or logout links in the template, than you can use `url_for` function and `odesk_is_authorized` variable::\n\n {% if odesk_is_authorized %}\n Log out\n {% else %}\n Upwork log in\n {% endif %}\n\nTo check the authorization of the current user you can use `is_authorized` method::\n\n @app.route('/test')\n def test():\n if odesk.is_authorized():\n return \"You are authorized.\"\n else:\n return \"You are not authorized yet.\"\n\nIf you need, you can start the authorization process manually from your code::\n\n if not odesk.is_authorized():\n return odesk.login()\n\nYou can also use `next` parameter to indicate URL, where will be redirect after the authorization process ends::\n\n if not odesk.is_authorized():\n return odesk.login(next='/blah/blah')\n\nYou can use `logout` method for user's logging out.\nPlease pay attention, that unlike `login` this method do not return the bulk of redirects.\nIt simply deletes the OAuth session. You should return response manually::\n\n if odesk.is_authorized():\n odesk.logout()\n return redirect('/')\n\nIf you want to expand autorization process, you can use `after_login` decorator,\nthat indicates your function, which will be called after successfully authorization::\n\n @odesk.after_login\n def save_session():\n # Getting current user's data. Please, see below how to use the Client.\n session['user'] = odesk.get_client().hr.get_user('me')\n\nIf you have used `after_login` and saved something to the session, please,\ndo not forget to delete this session after logging out, using decorator `after_logout`::\n\n @odesk.after_logout\n def delete_session():\n if 'user' in session:\n del session['user']\n\n\nUsing client\n============\n\nYou can use `get_access_token` method to get the current access token and access token secret,\nthat can be stored in DB and used for access to the client later, if necessary::\n\n if odesk.is_authorized():\n access_token, access_token_secret = odesk.get_access_token()\n\nYou can use `get_client` method to get the client::\n\n if odesk.is_authorized():\n c = odesk.get_client()\n c.team.get_teamrooms()\n\nOr you can use the client even if the current user is not authorized,\nbut you have the access token and access token secret::\n\n if not odesk.is_authorized():\n c = odesk.get_client(access_token, access_token_secret)\n c.team.get_teamrooms()", "description_content_type": null, "docs_url": null, "download_url": "http://github.com/strogonoff/flask-upwork", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/strogonoff/flask-upwork", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "Flask-Upwork", "package_url": "https://pypi.org/project/Flask-Upwork/", "platform": "any", "project_url": "https://pypi.org/project/Flask-Upwork/", "project_urls": { "Download": "http://github.com/strogonoff/flask-upwork", "Homepage": "https://github.com/strogonoff/flask-upwork" }, "release_url": "https://pypi.org/project/Flask-Upwork/0.4.1.1/", "requires_dist": null, "requires_python": null, "summary": "Upwork API support to Flask", "version": "0.4.1.1" }, "last_serial": 1573405, "releases": { "0.4.1.1": [ { "comment_text": "", "digests": { "md5": "3cc161a8b6aece919d2086b11a0748c1", "sha256": "e5de1a268f864869df97e78cd80c897117470b56a0fa25386885debed2d3c39d" }, "downloads": -1, "filename": "Flask-Upwork-0.4.1.1.tar.gz", "has_sig": false, "md5_digest": "3cc161a8b6aece919d2086b11a0748c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4732, "upload_time": "2015-05-19T14:07:37", "url": "https://files.pythonhosted.org/packages/cf/1b/78063b662a495e5badd19d5b1b1e42544388fdb4c6484bbc94d106d39510/Flask-Upwork-0.4.1.1.tar.gz" } ], "1.0-pre1": [ { "comment_text": "", "digests": { "md5": "8740c4c8b005ee5e14158dcb9840af7b", "sha256": "e56b35cb6f27d4f6d48c09fb443a39847e0e4db5423419bd6ebc2cab880cffae" }, "downloads": -1, "filename": "Flask-Upwork-1.0-pre1.tar.gz", "has_sig": false, "md5_digest": "8740c4c8b005ee5e14158dcb9840af7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4747, "upload_time": "2015-05-21T15:23:43", "url": "https://files.pythonhosted.org/packages/3e/c6/ba8a0770ccbd7556108577eb7de58514b311b7a4d41a0b328ccd14bbb993/Flask-Upwork-1.0-pre1.tar.gz" } ], "1.0-pre2": [ { "comment_text": "", "digests": { "md5": "4722f0bed3843ab88d2bd15a70f021bd", "sha256": "eb889f7497bbef6aabea0d4d634b01a11c7e132e99f1fe2b0ea9d20c2d6ab5e4" }, "downloads": -1, "filename": "Flask-Upwork-1.0-pre2.tar.gz", "has_sig": false, "md5_digest": "4722f0bed3843ab88d2bd15a70f021bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4731, "upload_time": "2015-06-01T14:34:27", "url": "https://files.pythonhosted.org/packages/20/fa/def272a624d4414f978ecb8db3a65b4f4cb92b6b7ab44a6f9bba70b9767e/Flask-Upwork-1.0-pre2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3cc161a8b6aece919d2086b11a0748c1", "sha256": "e5de1a268f864869df97e78cd80c897117470b56a0fa25386885debed2d3c39d" }, "downloads": -1, "filename": "Flask-Upwork-0.4.1.1.tar.gz", "has_sig": false, "md5_digest": "3cc161a8b6aece919d2086b11a0748c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4732, "upload_time": "2015-05-19T14:07:37", "url": "https://files.pythonhosted.org/packages/cf/1b/78063b662a495e5badd19d5b1b1e42544388fdb4c6484bbc94d106d39510/Flask-Upwork-0.4.1.1.tar.gz" } ] }