import requests class TypographError(Exception): pass def typograph(text): text = text.replace('&', '&') text = text.replace('<', '<') text = text.replace('>', '>') template = f''' {text} 3 0 0 0 ''' result = requests.post( url='http://typograf.artlebedev.ru/webservices/typograf.asmx', data=template.encode('utf-8'), headers={ 'Content-Type': 'text/xml', 'SOAPAction': 'http://typograf.artlebedev.ru/webservices/ProcessText' } ) if result.ok and 'ProcessTextResult' in result.text: result_text = result.text.split('')[1].split('')[0].rstrip() result_text = result_text.replace('&', '&') result_text = result_text.replace('<', '<') result_text = result_text.replace('>', '>') return result_text else: raise TypographError(result.text) if __name__ == '__main__': import sys print(typograph(sys.stdin.read()))