mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 01:47:36 +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
		
			
				
	
	
		
			19 lines
		
	
	
		
			444 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			444 B
		
	
	
	
		
			Python
		
	
	
	
	
	
"""Services module."""
 | 
						|
 | 
						|
from .giphy import GiphyClient
 | 
						|
 | 
						|
 | 
						|
class SearchService:
 | 
						|
 | 
						|
    def __init__(self, giphy_client: GiphyClient):
 | 
						|
        self._giphy_client = giphy_client
 | 
						|
 | 
						|
    async def search(self, query, limit):
 | 
						|
        """Search for gifs and return formatted data."""
 | 
						|
        if not query:
 | 
						|
            return []
 | 
						|
 | 
						|
        result = await self._giphy_client.search(query, limit)
 | 
						|
 | 
						|
        return [{'url': gif['url']} for gif in result['data']]
 |