mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 01:47:36 +03:00 
			
		
		
		
	* Make a code style change to the giphynav-aiohttp app * Make minimal punctuation changes for the flask tutorial * Add parts of http tutorial * Fix few issues in the flask tutorial * Make some cosmetic changes to test data * Fix typo in flask tutorial * Add more tutorial sections
		
			
				
	
	
		
			34 lines
		
	
	
		
			852 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			852 B
		
	
	
	
		
			Python
		
	
	
	
	
	
"""Application containers module."""
 | 
						|
 | 
						|
from dependency_injector import containers, providers
 | 
						|
from dependency_injector.ext import aiohttp
 | 
						|
from aiohttp import web
 | 
						|
 | 
						|
from . import giphy, services, views
 | 
						|
 | 
						|
 | 
						|
class ApplicationContainer(containers.DeclarativeContainer):
 | 
						|
    """Application container."""
 | 
						|
 | 
						|
    app = aiohttp.Application(web.Application)
 | 
						|
 | 
						|
    config = providers.Configuration()
 | 
						|
 | 
						|
    giphy_client = providers.Factory(
 | 
						|
        giphy.GiphyClient,
 | 
						|
        api_key=config.giphy.api_key,
 | 
						|
        timeout=config.giphy.request_timeout,
 | 
						|
    )
 | 
						|
 | 
						|
    search_service = providers.Factory(
 | 
						|
        services.SearchService,
 | 
						|
        giphy_client=giphy_client,
 | 
						|
    )
 | 
						|
 | 
						|
    index_view = aiohttp.View(
 | 
						|
        views.index,
 | 
						|
        search_service=search_service,
 | 
						|
        default_query=config.search.default_query,
 | 
						|
        default_limit=config.search.default_limit,
 | 
						|
    )
 |