Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: appengine/findit/common/rietveld.py

Issue 2116073002: [Findit] Fix redirect bug and update template for waterfall/culprit. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Add one unittest. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/findit/common/http_client_appengine.py ('k') | appengine/findit/handlers/culprit.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import re 6 import re
7 import urlparse 7 import urlparse
8 8
9 from common.codereview import CodeReview 9 from common.codereview import CodeReview
10 from common.http_client_appengine import HttpClientAppengine 10 from common.http_client_appengine import HttpClientAppengine
11 11
12 12
13 _RIETVELD_ISSUE_NUMBER_RE = re.compile('^/(\d+)/?.*') 13 _RIETVELD_ISSUE_NUMBER_RE = re.compile('^/(\d+)/?.*')
14 14
15 15
16 class Rietveld(CodeReview): 16 class Rietveld(CodeReview):
17 """The implementation of CodeReview interface for Rietveld.""" 17 """The implementation of CodeReview interface for Rietveld."""
18 HTTP_CLIENT = HttpClientAppengine() 18 HTTP_CLIENT = HttpClientAppengine(follow_redirects=False)
19 19
20 def _GetXsrfToken(self, rietveld_url): 20 def _GetXsrfToken(self, rietveld_url):
21 """Returns the xsrf token for follow-up requests.""" 21 """Returns the xsrf token for follow-up requests."""
22 headers = { 22 headers = {
23 'X-Requesting-XSRF-Token': '1', 23 'X-Requesting-XSRF-Token': '1',
24 'Accept': 'text/plain', 24 'Accept': 'text/plain',
25 } 25 }
26 url = '%s/xsrf_token' % rietveld_url 26 url = '%s/xsrf_token' % rietveld_url
27 status_code, xsrf_token = self.HTTP_CLIENT.Post( 27 status_code, xsrf_token = self.HTTP_CLIENT.Post(
28 url, data=None, headers=headers) 28 url, data=None, headers=headers)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 'no_redirect': 'True', 77 'no_redirect': 'True',
78 } 78 }
79 content_type, body = self._EncodeMultipartFormData(form_fields) 79 content_type, body = self._EncodeMultipartFormData(form_fields)
80 headers = { 80 headers = {
81 'Content-Type': content_type, 81 'Content-Type': content_type,
82 'Accept': 'text/plain', 82 'Accept': 'text/plain',
83 } 83 }
84 status_code, content = self.HTTP_CLIENT.Post( 84 status_code, content = self.HTTP_CLIENT.Post(
85 url, data=body, headers=headers) 85 url, data=body, headers=headers)
86 return status_code == 200 and content == 'OK' 86 return status_code == 200 and content == 'OK'
OLDNEW
« no previous file with comments | « appengine/findit/common/http_client_appengine.py ('k') | appengine/findit/handlers/culprit.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698