def post_outcome_request(self):
if not self.has_required_attributes():<EOL><INDENT>raise InvalidLTIConfigError(<EOL>'<STR_LIT>')<EOL><DEDENT>consumer = oauth2.Consumer(key=self.consumer_key,<EOL>secret=self.consumer_secret)<EOL>client = oauth2.Client(consumer)<EOL>monkey_patch_headers = True<EOL>monkey_patch_function = None<EOL>if monkey_patch_headers:<EOL><INDENT>import httplib2<EOL>http = httplib2.Http<EOL>normalize = http._normalize_headers<EOL>def my_normalize(self, headers):<EOL><INDENT>print("<STR_LIT>", headers)<EOL>ret = normalize(self, headers)<EOL>if '<STR_LIT>' in ret:<EOL><INDENT>ret['<STR_LIT>'] = ret.pop('<STR_LIT>')<EOL><DEDENT>print("<STR_LIT>", ret)<EOL>return ret<EOL><DEDENT>http._normalize_headers = my_normalize<EOL>monkey_patch_function = normalize<EOL><DEDENT>response, content = client.request(<EOL>self.lis_outcome_service_url,<EOL>'<STR_LIT:POST>',<EOL>body=self.generate_request_xml(),<EOL>headers={'<STR_LIT:Content-Type>': '<STR_LIT>'})<EOL>if monkey_patch_headers and monkey_patch_function:<EOL><INDENT>import httplib2<EOL>http = httplib2.Http<EOL>http._normalize_headers = monkey_patch_function<EOL><DEDENT>self.outcome_response = OutcomeResponse.from_post_response(response,<EOL>content)<EOL>return self.outcome_response<EOL>
POST an OAuth signed request to the Tool Consumer.