Skip to content
Snippets Groups Projects
Commit 4745b7f2 authored by Mattia Mancini's avatar Mattia Mancini
Browse files

PEP8 formatting

parent d17f634b
No related branches found
No related tags found
1 merge request!1Make xmlrpc use socks proxy
...@@ -8,8 +8,6 @@ import xml.etree.ElementTree as ET ...@@ -8,8 +8,6 @@ import xml.etree.ElementTree as ET
import xmlrpc.client import xmlrpc.client
import uuid import uuid
import copy import copy
import logging
logger = logging.getLogger(__name__)
path = expanduser("~/.siplibrc") path = expanduser("~/.siplibrc")
user = None user = None
...@@ -25,7 +23,7 @@ if not exists(path): ...@@ -25,7 +23,7 @@ if not exists(path):
file.write("host=\n") file.write("host=\n")
with open(path, 'r') as file: with open(path, 'r') as file:
logger.info("Parsing user credentials from %s" % path) print("Parsing user credentials from", path)
for line in file: for line in file:
if line.startswith("user"): if line.startswith("user"):
user = line.split('=')[1].strip() user = line.split('=')[1].strip()
...@@ -42,16 +40,17 @@ login_data = { ...@@ -42,16 +40,17 @@ login_data = {
url = 'https://' + user + ':' + passw + '@' + host url = 'https://' + user + ':' + passw + '@' + host
client = xmlrpc.client.ServerProxy(url) client = xmlrpc.client.ServerProxy(url)
# id_cache = {} # id_cache = {}
def _call_idservice(source, userlabel=None): def _call_idservice(source, userlabel=None):
if userlabel is not None: if userlabel is not None:
response = client.GetUniqueIDForLabel(source, userlabel) response = client.GetUniqueIDForLabel(source, userlabel)
else: else:
response = client.GetUniqueID(source) response = client.GetUniqueID(source)
return response return response
# for testing: # for testing:
# if userlabel in id_cache: # if userlabel in id_cache:
# print "using existing", userlabel # print "using existing", userlabel
...@@ -103,9 +102,9 @@ def get_unique_id(source, userlabel): ...@@ -103,9 +102,9 @@ def get_unique_id(source, userlabel):
return response.get('id') return response.get('id')
def get_dataproduct_sip(projectname, dataproductid): def get_dataproduct_sip(projectname, dataproductid):
return client.GetSip(projectname, dataproductid).get("sip") return client.GetSip(projectname, dataproductid).get("sip")
def get_dataproduct_ids(projectname, sasid): def get_dataproduct_ids(projectname, sasid):
return client.GetDataProductIDS(projectname, sasid).get("ids") return client.GetDataProductIDS(projectname, sasid).get("ids")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment