{ "info": { "author": "Annouar", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "# pegass_auth\n> A tiny client to manage your Sellsy plateform using Python\n\nFrench Red Cross is currently using a tool named [Pegass](https://id.authentification.croix-rouge.fr/my.policy) to visualize, enroll to activities, monitor them and more... This application is carefully thought out, and the different views give you plenty options to display your data. However, my motivation was to extract Pegass data to analyze it and create some custom views. The application was not designed to let users get data out of the box (closed API, no CSV extract, ...). That's why I made this little module to help whoever wants to extract their data in a simple way through the Pegass API. :red_car: :red_car: :fire_engine: :fire_engine: :rotating_light: :rotating_light:\n\n### Features\n- Get authentication cookies to open Pegass API gate with your application credential\n- Create an abstraction for requesting the API\n\n\n## Installing\n```shell\n# Connect to your virtualenv\n$ workon projectenv\n\n# Use pip to install the package\n$ pip install pegass_auth\n```\n\nVerify now if the package as been successfully installed\n```shell\n$ python\n>> import pegass_auth # Should not raise exception\n```\n\n## Quick Start\n\n### Get authentication cookies to make requests out of the box\n\n```python\nimport os\nimport requests\nimport pegass_auth\n\nusername = os.environ['username']\npassword = os.environ['password']\n\nauth_cookies = pegass_auth.login(username, password)\n\n# When using 'requests' package\nr = requests.get('{}/crf/rest/gestiondesdroits'.format(pegass_auth.DEFAULT_PEGASS_URL), cookies=auth_cookies)\n\nif r.status_code == 200:\n print(r.json())\nelse:\n print('Request went wrong ! Status code returned : {}'.format(r.status_code)) \n```\n\n\n### Using package abstraction to make request\n\nThe package gives you two ways to make a request to Pegass API :\n- Using cookies :\n```python\nimport os\nimport pegass_auth as pegass\n\nauth_cookies = login(os.environ['username'], os.environ['password'])\nrules = pegass.request('crf/rest/gestiondesdroits', cookies=auth_cookies)\nprint(rules)\n```\n\n- Using credentials:\n```python\nimport os\nimport pegass_auth as pegass\n\nusername = os.environ['username']\npassword = os.environ['password']\nrules = pegass.request('crf/rest/gestiondesdroits', username=username, password=password)\nprint(rules)\n```\n**Note**: The last way to make request (the one with *username* and *password*) runs each time the ```login``` logic. Make *cookies* methods your first choice if you need to do multiple API requests.\n\nAll the previous codes prints the following response:\n```json\n{\n 'utilisateur':{\n 'id':'01XXXXXXXX',\n 'structure':{\n 'id':1XXX,\n 'typeStructure':'UL',\n 'libelle':'UNITE LOCALE DE XXXXXXX',\n 'libelleCourt':'XX',\n 'adresse':'XX XXXXXXXXXXXXXXXX XXXXXX XXXX XXXXXXXX',\n 'telephone':'X XX XX XX XX',\n 'mail':'ul.XXXXXXXXX@croix-rouge.fr',\n 'siteWeb':'XXXXXXXXXXXX.croix-rouge.fr/XXXXXXXX/',\n 'parent':{\n 'id':XX\n },\n 'structureMenantActiviteList':[\n {\n 'id':1XXX,\n 'libelle':'UNITE LOCALE DE XXXXXXX'\n }\n ]\n },\n 'nom':'Foo',\n 'prenom':'Bar',\n 'actif':True,\n 'mineur':False\n },\n 'structuresAdministrees':[\n\n ]\n}\n```\n\n## Pegass API Endpoints\nI've started to do a reverse engineering on Pegass app to list the API endpoints I need in order to achieve my personal app.\n\n## Error handler\nTheir is no error handler implemented yet in the package.\n\n\n## Links\n\n- [Pegass](https://id.authentification.croix-rouge.fr/my.policy)\n- [pegass_auth issue tracker](https://github.com/Annouar/pegass_auth/issues)\n- [French Red Cross](https://www.croix-rouge.fr/)\n\n\n## License\n\n - **MIT** : http://opensource.org/licenses/MIT", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Annouar/pegass_auth", "keywords": "pegass croix rouge login authentication", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pegass-auth", "package_url": "https://pypi.org/project/pegass-auth/", "platform": "", "project_url": "https://pypi.org/project/pegass-auth/", "project_urls": { "Bug Reports": "https://github.com/Annouar/pegass_auth/issues", "Homepage": "https://github.com/Annouar/pegass_auth" }, "release_url": "https://pypi.org/project/pegass-auth/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "pegass_auth is a tiny client tool to help you make some HTTP request on Pegass", "version": "1.0.0" }, "last_serial": 5293735, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "e4446a318cda8b944316ff6056472dfd", "sha256": "389340c306246876d7cf155f9f8a72ee67464afae49493bfc6551bc1eb6543f7" }, "downloads": -1, "filename": "pegass_auth-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e4446a318cda8b944316ff6056472dfd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3904, "upload_time": "2019-05-20T18:42:34", "url": "https://files.pythonhosted.org/packages/29/cc/30b3c73a9601285391add77e58d1b3cba635a3fe95efa65232121b8b3b7b/pegass_auth-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e4446a318cda8b944316ff6056472dfd", "sha256": "389340c306246876d7cf155f9f8a72ee67464afae49493bfc6551bc1eb6543f7" }, "downloads": -1, "filename": "pegass_auth-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e4446a318cda8b944316ff6056472dfd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3904, "upload_time": "2019-05-20T18:42:34", "url": "https://files.pythonhosted.org/packages/29/cc/30b3c73a9601285391add77e58d1b3cba635a3fe95efa65232121b8b3b7b/pegass_auth-1.0.0.tar.gz" } ] }