Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from apiron.endpoint.endpoint import Endpoint
class StreamingEndpoint(Endpoint):
"""
An endpoint that streams data incrementally
"""
streaming = True
def format_response(self, response):
"""
Stream response in chunks
:param requests.Response response:
The original response from :mod:`requests`
:return:
The response's content
:rtype:
generator
import collections
from apiron.endpoint.endpoint import Endpoint
class JsonEndpoint(Endpoint):
"""
An endpoint that returns :mimetype:`application/json`
"""
def __init__(
self, *args, path="/", default_method="GET", default_params=None, required_params=None, preserve_order=False
):
super().__init__(
path=path, default_method=default_method, default_params=default_params, required_params=required_params
)
self.preserve_order = preserve_order
def format_response(self, response):
"""
Extracts JSON data from the response