mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-10-25 05:01:11 +03:00 
			
		
		
		
	* Add aiohttp extension module * Add giphynav-aiohttp app * Add missing docstrings * Remove print() call * Remove not needed import from flask extension tests * Improve coroutine provider tests * Add aiohttp extension tests * Update tox.ini * Add aiohttp extras * Try fix Python 3.4 tests * Try fix 3.6 tests * Stop running coroutine tests for Python 3.4 * Rename tests * Remove type hints * Fix pypy and change python version for coverage job to 3.8 * Fix coveralls job * Try fix Python 3.4, 3.5 tests * Make coverage job to run 3.5+ tests * Add tests * Add readme * Update the readmes * Add API docs * Add API docs page * Update changelog
		
			
				
	
	
		
			26 lines
		
	
	
		
			552 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			552 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| """Views module."""
 | |
| 
 | |
| from aiohttp import web
 | |
| 
 | |
| from .services import SearchService
 | |
| 
 | |
| 
 | |
| async def index(
 | |
|         request: web.Request,
 | |
|         search_service: SearchService,
 | |
|         default_query: str,
 | |
|         default_limit: int,
 | |
| ) -> web.Response:
 | |
|     query = request.query.get('query', default_query)
 | |
|     limit = int(request.query.get('limit', default_limit))
 | |
| 
 | |
|     gifs = await search_service.search(query, limit)
 | |
| 
 | |
|     return web.json_response(
 | |
|         {
 | |
|             'query': query,
 | |
|             'limit': limit,
 | |
|             'gifs': gifs,
 | |
|         },
 | |
|     )
 |