Commit ed233254 authored by rogerta@chromium.org's avatar rogerta@chromium.org

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
parent 51e84fba
...@@ -24,6 +24,10 @@ def main(): ...@@ -24,6 +24,10 @@ def main():
parser.add_option( parser.add_option(
'-v', '--verbose', action='count', default=0, '-v', '--verbose', action='count', default=0,
help='Prints debugging infos') help='Prints debugging infos')
parser.add_option(
'-e',
'--email',
help='Email address for authenticating with Rietveld')
parser.add_option( parser.add_option(
'-i', '--issue', type='int', help='Rietveld issue number') '-i', '--issue', type='int', help='Rietveld issue number')
parser.add_option( parser.add_option(
...@@ -48,7 +52,7 @@ def main(): ...@@ -48,7 +52,7 @@ def main():
if not options.issue: if not options.issue:
parser.error('Require --issue') parser.error('Require --issue')
obj = rietveld.Rietveld(options.server, None, None) obj = rietveld.Rietveld(options.server, options.email, None)
if not options.patchset: if not options.patchset:
options.patchset = obj.get_issue_properties( options.patchset = obj.get_issue_properties(
......
...@@ -47,6 +47,12 @@ class Rietveld(object): ...@@ -47,6 +47,12 @@ class Rietveld(object):
extra_headers=extra_headers or {}) extra_headers=extra_headers or {})
else: else:
self.rpc_server = upload.GetRpcServer(url, email) 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 = None
self._xsrf_token_time = None self._xsrf_token_time = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment