{ "info": { "author": "Lucas Mendes", "author_email": "lucasam86@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "========\nServices\n========\n\nServices is a simple Django app to consume simple json services in a simple way.\nYou can make requests directly, async or recursive using failover services \nautomatically while the services return errors.\nExample::\n\n from services.models import Service\n\n service_example = Service(name='simple_service', method='get', url='http://example.com/?query_param=')\n url_data = {'': 'example_data'}\n service_response = service_example.request(url_data=get_data)\n\n if service_response['success']:\n respose_content = service_response['content'] # content is a dict\n print(response_content)\n\nPost example::\n\n from services.models import Service\n\n service_example = Service(name='simple_service', method='post', url='http://example.com/', headers='{\"Content-Type\": \"\"}', parameters= '{\"query_param\": \"\"}')\n get_data = {'': 'example_data'}\n header_data = {'': 'application/json'}\n service_response = service_example.request(get_data=get_data, header_data=header_data)\n\n if service_response['success']:\n respose_content = service_response['content'] # content is a dict\n print(response_content)\n\nOr simpler::\n\n\n from services.models import Service\n\n # This headers will be use for every request to this service\n service_example = Service(name='simple_service', method='post', url='http://example.com/', headers='{\"Content-Type\": \"application/json\"}')\n # parameters will be put directly to the body of the post request to the service\n parameters = {'query_param': 'example_data'}\n service_response = service_example.request(parameters=parameters)\n\n if service_response['success']:\n respose_content = service_response['content'] # content is a dict\n print(response_content)\n\nYou can also configure failover services, so if the primary service return some error code (for now >= 400) the failover/s will we call one by one untill some of them return a non error code::\n\n from services.models import Service, ServiceFailover\n\n service_01 = Service(name='registration_precheck', method='get', url='http://example_01.com/?query_param=').save()\n service_02 = Service(name='registration_precheck', method='get', url='http://example_02.com/?query_param=').save()\n service_03 = Service(name='registration_precheck', method='get', url='http://example_03.com/?query_param=').save()\n\n ServiceFailover(service=service_01, failover=service_02, order=1).save()\n ServiceFailover(service=service_01, failover=service_03, order=2).save()\n\n url_data = {'': 'example_data'}\n\n # Now if service_01 fails service_02 will be execute with the same context data,\n # the same for service_03 if service_02 fails in this call.\n service_response = service_example.request_recursive(url_data=get_data)\n\n if service_response['success']:\n respose_content = service_response['content'] # content is a dict\n print(response_content)\n\nIf you want to publish information to some service but you don't want to wait you can make async request::\n\n from services.models import Service\n\n service_example = Service(name='simple_service', method='post', url='http://example.com/', headers='{\"Content-Type\": \"application/json\"}')\n parameters = {'query_param': 'example_data'}\n # max_retry is the amount of retries do you want to execute the request while the answer is a error (0 if you want to retry \"forever\").\n # retry_interval is the amount of seconds you want to wait between retries.\n service_example.request_async(max_retry=10, retry_interval=1, parameters=parameters)\n\n\nQuick start\n-----------\n\n1. Run `pip install django-easy-services`\n\n2. Add \"services\" to your INSTALLED_APPS setting like this::\n\n INSTALLED_APPS = [\n ...\n 'services',\n ]\n\n3. Run `python manage.py migrate` to create the services models.\n\n4. Start the development server and visit http://127.0.0.1:8000/admin/services\n to create a services (you'll need the Admin app enabled).\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lmendes86/django-services/", "keywords": "", "license": "MIT License", "maintainer": "Lucas Mendes", "maintainer_email": "lucasam86@gmail.com", "name": "django-easy-services", "package_url": "https://pypi.org/project/django-easy-services/", "platform": "", "project_url": "https://pypi.org/project/django-easy-services/", "project_urls": { "Homepage": "https://github.com/lmendes86/django-services/" }, "release_url": "https://pypi.org/project/django-easy-services/0.2/", "requires_dist": [ "Django (>=1.8)", "requests (>=2.20.0)", "asyncio (>=3.4.3)" ], "requires_python": "", "summary": "A simple Django app to handle services request.", "version": "0.2" }, "last_serial": 4593951, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "91b6e784e5589ace777196c98f55e346", "sha256": "4e9e064abdcc2ea83864d95a441c80cc8e4b750301ffe64b92393f24635c499e" }, "downloads": -1, "filename": "django-easy-services-0.1.tar.gz", "has_sig": false, "md5_digest": "91b6e784e5589ace777196c98f55e346", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6881, "upload_time": "2018-11-29T22:59:17", "url": "https://files.pythonhosted.org/packages/a5/cd/5b59f5439ab72b94c6e4e777fdfa6d21729c3bc3574840e9401f66244fe9/django-easy-services-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "ffdde458fc4cdaffa4a8dc768d30ce72", "sha256": "9727ab9275e61ac9ef9897a3cb3370b92fa9340ad40091caa597f77ce34a534c" }, "downloads": -1, "filename": "django_easy_services-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "ffdde458fc4cdaffa4a8dc768d30ce72", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7672, "upload_time": "2018-12-13T11:00:14", "url": "https://files.pythonhosted.org/packages/cf/1f/57082d301ca7fc8209b626294492dd9aa36f881f3a499611863367d81144/django_easy_services-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "78d2a78d8e5eadd22703ec7ff9c797f3", "sha256": "eff36f73ea5dad9ada291e04037db06326068f29fc69bbca1b13bd87af91574f" }, "downloads": -1, "filename": "django-easy-services-0.2.tar.gz", "has_sig": false, "md5_digest": "78d2a78d8e5eadd22703ec7ff9c797f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5928, "upload_time": "2018-12-13T11:00:15", "url": "https://files.pythonhosted.org/packages/f7/e1/d8d793469aa87110b0700555a32e07337b0efa2bed22deb230caea4a07d3/django-easy-services-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ffdde458fc4cdaffa4a8dc768d30ce72", "sha256": "9727ab9275e61ac9ef9897a3cb3370b92fa9340ad40091caa597f77ce34a534c" }, "downloads": -1, "filename": "django_easy_services-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "ffdde458fc4cdaffa4a8dc768d30ce72", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7672, "upload_time": "2018-12-13T11:00:14", "url": "https://files.pythonhosted.org/packages/cf/1f/57082d301ca7fc8209b626294492dd9aa36f881f3a499611863367d81144/django_easy_services-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "78d2a78d8e5eadd22703ec7ff9c797f3", "sha256": "eff36f73ea5dad9ada291e04037db06326068f29fc69bbca1b13bd87af91574f" }, "downloads": -1, "filename": "django-easy-services-0.2.tar.gz", "has_sig": false, "md5_digest": "78d2a78d8e5eadd22703ec7ff9c797f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5928, "upload_time": "2018-12-13T11:00:15", "url": "https://files.pythonhosted.org/packages/f7/e1/d8d793469aa87110b0700555a32e07337b0efa2bed22deb230caea4a07d3/django-easy-services-0.2.tar.gz" } ] }