system-config/tools/lp_openid_lookup
Monty Taylor e69c7b7fb9 Rename review.openstack.org to review.opendev.org
There are many references to review.openstack.org, and while the
redirect should work, we can also go ahead and fix them.

Change-Id: I28f398796a6392a3dffea1d25cfe2ae3a36a3589
2019-05-09 14:38:51 +00:00

34 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python
# Copyright (c) 2016 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Simple wrapper for the OpenId reverse lookup method in the LP API,
# useful when you need to determine the LP account associated with a
# login.launchpad.net OpenId. Pass the OpenId URL in question as the
# only command-line parameter, and run this in the gerrit2 homedir on
# review.opendev.org (or hack it to use your own LP API key instead).
import os
import sys
from launchpadlib import launchpad
from launchpadlib import uris
lp = launchpad.Launchpad.login_with(
'Gerrit User Sync', uris.LPNET_SERVICE_ROOT,
os.path.expanduser('~/.launchpadlib/cache'),
credentials_file=os.path.expanduser('~/.launchpadlib/creds'),
version='devel')
print(lp.people.getByOpenIDIdentifier(identifier=sys.argv[1]))