{ "info": { "author": "Tpaga", "author_email": "devs@tpaga.co", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\n# Generic Rest Client\n\nA generic and simple REST client for your python projects.\n\n\n# How to install\n\n pip install generic_rest_client\n\n# How to use\n\n## Create your custom class\n\nFirst you will need to create your own class and extend GenericRestClient, \nfor example, lets see our mocky client.\n\n```python\nfrom generic_rest_client.client import GenericRestClient\n...\nclass MockyRestClient(GenericRestClient):\n...\n```\n\n## Create custom methods\n\nEvery endpoint usually behaves differently, so we will create two functions \nthat knows how to handle the requests.\n\n### Obtain all comments\n\nThis function knows how to obtain all comments, at least you will have to \ndefine:\n\n* **Request type**: we know it is a GET request.\n* **Endpoint name**: in this case '/comments'\n* **Body params**: in this case it is not required\n* **Expected http code**: We define HTTP 200 as an expected response.\n\nThen we will have: \n\n```python\n...\ndef get_comments(self):\n ...\n endpoint_url = '/comments'\n\n return self.get_request(\n urljoin(self.base_url, endpoint_url),\n None,\n [200, ]\n )\n...\n```\n\n### Create a new post\n\nAs we said, we create a function that knows what we will need to \ncreate a new post. To create a new post at least we will have to define: \n\n* **Request type**: we know it is a POST request.\n* **Endpoint name**: in this case '/posts'\n* **Body params**: We create a dictionary that contains all the required params.\n* **Expected http code**: We define HTTP 201 as an expected response.\n\nThen we will have:\n\n```python\n...\ndef new_post(self, params):\n ...\n endpoint_url = '/posts'\n\n body_params = dict(\n title=params['title'],\n body=params['body'],\n )\n\n return self.post_request(\n urljoin(self.base_url, endpoint_url),\n body_params,\n [201, ]\n )\n...\n```\n\n### Update a post\n\nJust like creating a new post, we will create a new function and define: \n\n* **Request type**: we know it is a PUT request.\n* **Endpoint name**: in this case it will be '/posts/{post_id}'. \n* **Body params**: We create a dictionary that contains all the required params.\n* **Expected http code**: We define HTTP 200 as an expected response.\n\n```python\n...\ndef update_post(self, post_id, params):\n ...\n endpoint_url = '/posts/{post_id}'.format(\n post_id=post_id,\n )\n\n body_params = dict(\n title=params['title'],\n body=params['body'],\n )\n\n return self.put_request(\n urljoin(self.base_url, endpoint_url),\n body_params,\n [200, ]\n )\n...\n```\n\nSee? it's really simple. Good luck with your projects! :)\n\nIf you want, you can check out our examples section.\n\n# Licence\n\nMIT License\n\nCopyright (c) 2018 Tpaga.co\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n# Our Company\n\nMade with love at [Tpaga](https://tpaga.co), come work with us! jobs@tpaga.co\n\n", "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/Tpaga/generic_rest_client", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "generic-rest-client", "package_url": "https://pypi.org/project/generic-rest-client/", "platform": "", "project_url": "https://pypi.org/project/generic-rest-client/", "project_urls": { "Homepage": "https://github.com/Tpaga/generic_rest_client" }, "release_url": "https://pypi.org/project/generic-rest-client/0.2.1/", "requires_dist": [ "requests" ], "requires_python": ">=3.6.0", "summary": "A generic and simple REST client for your python projects.", "version": "0.2.1" }, "last_serial": 4770792, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "77890c16874ae5866abc391040061a25", "sha256": "b96c9fedd95a3b40d60e937a399be1e1b70690ea21c581837449bef00f223342" }, "downloads": -1, "filename": "generic_rest_client-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "77890c16874ae5866abc391040061a25", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9732, "upload_time": "2018-09-30T22:56:47", "url": "https://files.pythonhosted.org/packages/2c/a1/d36c9d14e7c02cf6025cf4213ff4d15db827df81db8191c7b79b67a5986c/generic_rest_client-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "453c11a83f2d8052b723d84d9da4df68", "sha256": "c2855e7011d35b9a1c0a088308231b17b08c4905e9b2b9de2560182791aace01" }, "downloads": -1, "filename": "generic-rest-client-0.1.0.tar.gz", "has_sig": false, "md5_digest": "453c11a83f2d8052b723d84d9da4df68", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6574, "upload_time": "2018-09-30T22:56:48", "url": "https://files.pythonhosted.org/packages/0e/e2/9c7e91533e791d641c679270b70c816ee341a260c811f199956b5feb1b2d/generic-rest-client-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "3d0e0e1904dbde81fcbc0cf369f800a5", "sha256": "3aedeae01c364814b3b5a42acc2660b051fcfc1071a535fa4bffdaf14034abb8" }, "downloads": -1, "filename": "generic_rest_client-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3d0e0e1904dbde81fcbc0cf369f800a5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14245, "upload_time": "2018-10-01T00:26:00", "url": "https://files.pythonhosted.org/packages/6c/18/e34bfca36bc4f53ad4996cce26f0ea249a9d1c7a54f3e283c6ec5b169ec2/generic_rest_client-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bfcceb0642712b368644c0ade41eed49", "sha256": "9b81908ffa6e1b39938195be369ff7bdd2bfd56b69618415b708a1084af603c0" }, "downloads": -1, "filename": "generic_rest_client-0.1.1.tar.gz", "has_sig": false, "md5_digest": "bfcceb0642712b368644c0ade41eed49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6593, "upload_time": "2018-10-01T00:26:01", "url": "https://files.pythonhosted.org/packages/cf/22/7a9f639c96c476dc5a840efac5b7644edb7b572b64a0d96edad34ff1bb4c/generic_rest_client-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "70b9060ff520d04396dfe4178b49b411", "sha256": "784ed514f04c9149d76d8dfa2af378dac11a31c575de0f2f4702a67ae629c6dc" }, "downloads": -1, "filename": "generic_rest_client-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "70b9060ff520d04396dfe4178b49b411", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15499, "upload_time": "2018-10-01T00:51:02", "url": "https://files.pythonhosted.org/packages/26/48/72f4598cbdaa73102fc4578a9fb1145de6d19566ec601ccb89d696f49fbe/generic_rest_client-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c6827182fcc5f868d8bc46e9b6e982c9", "sha256": "2cb47714403034a2a86b480aea05403aaec0654d6d4ac3e3a013ebaae988cf19" }, "downloads": -1, "filename": "generic_rest_client-0.1.2.tar.gz", "has_sig": false, "md5_digest": "c6827182fcc5f868d8bc46e9b6e982c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6599, "upload_time": "2018-10-01T00:51:04", "url": "https://files.pythonhosted.org/packages/41/cf/3d48d8709b2124c2ab80c33de9a69debcb10ac54cc97b5508ed8044561d5/generic_rest_client-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "784b2ccc2d8397746bbc115ab5c3c107", "sha256": "38d143920db00fe656dc593b8a99ed547053bf7655ea864a04ae6f7bce8e3e27" }, "downloads": -1, "filename": "generic_rest_client-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "784b2ccc2d8397746bbc115ab5c3c107", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 15619, "upload_time": "2018-10-01T03:07:31", "url": "https://files.pythonhosted.org/packages/8e/e4/4bcdadc0c20162396ef1bab550f7f224f1c845e43a985d122c3d71d06c02/generic_rest_client-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fbdf0de61ddef1008dc856dd22e53c98", "sha256": "c9c58e86f5656e7d9cf7f8be0d42b26473149f03b724c79a9d676643cf543c6b" }, "downloads": -1, "filename": "generic_rest_client-0.1.3.tar.gz", "has_sig": false, "md5_digest": "fbdf0de61ddef1008dc856dd22e53c98", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5618, "upload_time": "2018-10-01T03:07:32", "url": "https://files.pythonhosted.org/packages/ba/e6/1d754089902e8a853c72eda313d5150993a3f9006a2fb0ea9b63f7b80d48/generic_rest_client-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ab642d47ea77138f9b8164cd0c5cfa65", "sha256": "46b65b6ee2ede7f35c7e77edde3a286185337fe9893e5b6cebdb09e8260e9df9" }, "downloads": -1, "filename": "generic_rest_client-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ab642d47ea77138f9b8164cd0c5cfa65", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 15874, "upload_time": "2018-10-25T04:38:27", "url": "https://files.pythonhosted.org/packages/05/c1/64b56e5cc4843e6e415fb6ebb194601a513d5f2665f5908f8991cb5b7e0e/generic_rest_client-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1f585e67f6178404231c9a05af19740b", "sha256": "c78aebfe632c1443d436d9dec4c94b7ff4e1a94b2564c47f8530b49778531f83" }, "downloads": -1, "filename": "generic_rest_client-0.2.0.tar.gz", "has_sig": false, "md5_digest": "1f585e67f6178404231c9a05af19740b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5824, "upload_time": "2018-10-25T04:38:29", "url": "https://files.pythonhosted.org/packages/20/96/6e755117471b57c22a6abc376158fb0d17da3794f642eea928edb7c0f794/generic_rest_client-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "a4ba2817ac09a81ca5b2b35ca1d5e943", "sha256": "389f1955f53090a57e06250a5a76b8808f11a186a3558f8a21de88f55cd3b4a8" }, "downloads": -1, "filename": "generic_rest_client-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a4ba2817ac09a81ca5b2b35ca1d5e943", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 6045, "upload_time": "2019-02-01T22:49:39", "url": "https://files.pythonhosted.org/packages/5c/bc/98aaa4ef2a8a52320df4f8b1a1833bb345e9a1f6d2d71a454a73b74967ba/generic_rest_client-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b88804431e0c00cdba4c97b7b33e157d", "sha256": "cee978cef50143c370ccd256760e2196a66611c5d6d024443befc8834a090632" }, "downloads": -1, "filename": "generic_rest_client-0.2.1.tar.gz", "has_sig": false, "md5_digest": "b88804431e0c00cdba4c97b7b33e157d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5869, "upload_time": "2019-02-01T22:49:40", "url": "https://files.pythonhosted.org/packages/40/da/67a49ccd69686457166f9c940cf349e3304bd4fd1f0f760caaf1df0cf4c8/generic_rest_client-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a4ba2817ac09a81ca5b2b35ca1d5e943", "sha256": "389f1955f53090a57e06250a5a76b8808f11a186a3558f8a21de88f55cd3b4a8" }, "downloads": -1, "filename": "generic_rest_client-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a4ba2817ac09a81ca5b2b35ca1d5e943", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 6045, "upload_time": "2019-02-01T22:49:39", "url": "https://files.pythonhosted.org/packages/5c/bc/98aaa4ef2a8a52320df4f8b1a1833bb345e9a1f6d2d71a454a73b74967ba/generic_rest_client-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b88804431e0c00cdba4c97b7b33e157d", "sha256": "cee978cef50143c370ccd256760e2196a66611c5d6d024443befc8834a090632" }, "downloads": -1, "filename": "generic_rest_client-0.2.1.tar.gz", "has_sig": false, "md5_digest": "b88804431e0c00cdba4c97b7b33e157d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5869, "upload_time": "2019-02-01T22:49:40", "url": "https://files.pythonhosted.org/packages/40/da/67a49ccd69686457166f9c940cf349e3304bd4fd1f0f760caaf1df0cf4c8/generic_rest_client-0.2.1.tar.gz" } ] }