Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python snippet from Giuseppe La Rocca to obtain a proxy from an etoken server.
#!/usr/bin/env python
#
# Copyright 2016 EGI 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.
#
#/
import httplib
import xmltodict
def etoken_call(c):
conn = httplib.HTTPSConnection('etokenserver2.ct.infn.it', 8443, cert_file='./hostcert.pem', key_file='./hostkey.pem')
conn.request("GET", c)
data = conn.getresponse().read()
conn.close()
return data
def main():
proxy = etoken_call('/eTokenServer/eToken/bc779e33367eaad7882b9dfaa83a432c?voms=fedcloud.egi.eu:/fedcloud.egi.eu&proxy-renewal=false&disable-voms-proxy=false&rfc-proxy=true&cn-label=eToken:Empty')
print "proxy = %s " %proxy
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.