Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Converted to Python 3 code using 2to3 command
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-magenta committed Jan 4, 2018
1 parent a3cba05 commit 37ffe98
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions webscanner_client/webscanner_client/webscanner_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Webscanner client API class."""

import os
import xmlrpclib
import xmlrpc.client


class WebscannerClient(object):
Expand All @@ -13,7 +13,7 @@ def __init__(self, url, verbose=False):
self._url = url
rpc_args = {'verbose': verbose, 'allow_none': True}

self._rpc_srv = xmlrpclib.ServerProxy(self._url, **rpc_args)
self._rpc_srv = xmlrpc.client.ServerProxy(self._url, **rpc_args)

def scan_urls(self, user, password, urls, params={}):
"""Scan given URLs with the user credentials provided."""
Expand All @@ -23,10 +23,10 @@ def scan_documents(self, user, password, documents, params={}):
"""Scan documents in list, upload to server for scan."""
def get_binary(path):
with open(path, "rb") as f:
return xmlrpclib.Binary(f.read())
docs = map(get_binary, documents)
filenames = map(os.path.basename, documents)
data = zip(docs, filenames)
return xmlrpc.client.Binary(f.read())
docs = list(map(get_binary, documents))
filenames = list(map(os.path.basename, documents))
data = list(zip(docs, filenames))

return self._rpc_srv.scan_documents(user, password, data, params)

Expand Down

0 comments on commit 37ffe98

Please sign in to comment.