async def _service_request_without_rate_limits( self, request_args: AioHTTPRequestArgs, required_sid: bool, ) -> aiohttp.ClientResponse: """Post data to url. :param request_args: request args :param required_sid: is this method required sid :return: response """ if required_sid is True: request_data = request_args.data or {} request_data['sid'] = await self.get_sid() request_args.data = request_data # NOQA:WPS110 if request_args.data: request_args.data = { # NOQA:WPS110 key: value for key, value in request_args.data.items() # NOQA:WPS110 if value is not None } logger.info( 'Service post: %s. Params: %s', request_args.full_url, str(clear_params(request_args.data)), ) return await self.service_session.request( method=request_args.method, url=request_args.full_url, **request_args.dict_optional_args(self._autocast_arguments, ), )
def _service_request_without_rate_limits( self, request_args: RequestArgs, required_sid: bool, ) -> requests.Response: """Post data to url. :param request_args: request args :param required_sid: is this method required sid :return: response """ if required_sid is True: request_data = request_args.data or {} request_data['sid'] = self.sid request_args.data = request_data # NOQA:WPS110 logger.info( 'Service post: %s. Params: %s', request_args.url, str(clear_params(request_args.data)), ) return self.service_session.request( method=request_args.method, url=request_args.full_url, **request_args.dict_optional_args( self._autocast_arguments, ), )
async def storage_delete( self, url: str, required_sid: bool, **kwargs, ) -> aiohttp.ClientResponse: """Delete from storage. :param url: url :param required_sid: is this method required sid :param kwargs: request arguments :return: response obj """ kwargs = await self._prepare_storage_request_args( required_sid=required_sid, **kwargs, ) logger.info( 'Storage delete: %s. Params: %s', url, str(clear_params(kwargs.get('params', {}))), ) return await self.storage_session.delete(url=url, **kwargs)
def storage_post( self, url: str, required_sid: bool, **kwargs, ) -> requests.Response: """Post to storage. :param url: url :param required_sid: is this method required sid :param kwargs: request arguments :return: response obj """ kwargs = self._prepare_storage_request_args( required_sid=required_sid, **kwargs, ) logger.info( 'Storage post: %s. Params: %s', url, str(clear_params(kwargs.get('params', {}))), ) return self.storage_session.post(url=url, **kwargs)