From ed2332542c171b2e4ca2f96ba8ab090d7c4665a3 Mon Sep 17 00:00:00 2001 From: "rogerta@chromium.org" Date: Fri, 6 Jul 2012 17:25:11 +0000 Subject: [PATCH] Allow apply_issue.py to make api calls to rietveld that don't require authentication. Also allow apply_issue.py to specify a username if needed. BUG=43563 TEST=Make sure that sending try jobs directly from rietveld works. Review URL: https://chromiumcodereview.appspot.com/10704111 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@145600 0039d316-1c4b-4281-b951-d872f2087c98 --- apply_issue.py | 6 +++++- rietveld.py | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apply_issue.py b/apply_issue.py index 52f31882d..6784ce535 100755 --- a/apply_issue.py +++ b/apply_issue.py @@ -24,6 +24,10 @@ def main(): parser.add_option( '-v', '--verbose', action='count', default=0, help='Prints debugging infos') + parser.add_option( + '-e', + '--email', + help='Email address for authenticating with Rietveld') parser.add_option( '-i', '--issue', type='int', help='Rietveld issue number') parser.add_option( @@ -48,7 +52,7 @@ def main(): if not options.issue: parser.error('Require --issue') - obj = rietveld.Rietveld(options.server, None, None) + obj = rietveld.Rietveld(options.server, options.email, None) if not options.patchset: options.patchset = obj.get_issue_properties( diff --git a/rietveld.py b/rietveld.py index 0323332cd..e3da3f0e5 100644 --- a/rietveld.py +++ b/rietveld.py @@ -47,6 +47,12 @@ class Rietveld(object): extra_headers=extra_headers or {}) else: self.rpc_server = upload.GetRpcServer(url, email) + # If email is given as an empty string, then assume we want to make + # requests that do not need authentication. Bypass authentication by + # setting the flag to True. + if email == '': + self.rpc_server.authenticated = True + self._xsrf_token = None self._xsrf_token_time = None