Skip to content

Commit

Permalink
fix: dependencies and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
lmendes86 committed Apr 8, 2021
1 parent 28d5821 commit 7ce9530
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Services
========

Services is a simple Django app to consume simple json services in a simple way.
Services is a simple Django app to consume json services in a simple way.
You can make requests directly, async or recursive using failover services
automatically while the services return errors.
Example::
Expand All @@ -13,8 +13,10 @@ Example::
url_data = {'<data>': 'example_data'}
service_response = service_example.request(url_data=get_data)

# By default http responses higher than 400 are not consider as successful,
# this can we tweaked in the service instance by adding codes to accepted_codes or rejected_codes.
if service_response['success']:
respose_content = service_response['content'] # content is a dict
response_content = service_response['content'] # content is a dict
print(response_content)

Post example::
Expand All @@ -27,7 +29,7 @@ Post example::
service_response = service_example.request(get_data=get_data, header_data=header_data)

if service_response['success']:
respose_content = service_response['content'] # content is a dict
response_content = service_response['content'] # content is a dict
print(response_content)

Or simpler::
Expand All @@ -42,7 +44,7 @@ Or simpler::
service_response = service_example.request(parameters=parameters)

if service_response['success']:
respose_content = service_response['content'] # content is a dict
response_content = service_response['content'] # content is a dict
print(response_content)

You 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::
Expand All @@ -63,7 +65,7 @@ You can also configure failover services, so if the primary service return some
service_response = service_example.request_recursive(url_data=get_data)

if service_response['success']:
respose_content = service_response['content'] # content is a dict
response_content = service_response['content'] # content is a dict
print(response_content)

If you want to publish information to some service but you don't want to wait you can make async request::
Expand Down Expand Up @@ -92,4 +94,4 @@ Quick start
3. Run `python manage.py migrate` to create the services models.

4. Start the development server and visit http://127.0.0.1:8000/admin/services
to create a services (you'll need the Admin app enabled).
to create a service (you'll need the Admin app enabled).
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

setup(
name='django-easy-services',
version='0.2',
version='0.3',
packages=find_packages(),
include_package_data=True,
install_requires=['Django>=1.8', 'requests>=2.20.0', 'asyncio>=3.4.3'],
install_requires=['Django>=1.8', 'requests>=2.20.0', 'asyncio>=3.4.3', 'django-multiselectfield>=0.1.12'],
license='MIT License',
description='A simple Django app to handle services request.',
long_description=README,
Expand Down

0 comments on commit 7ce9530

Please sign in to comment.