Show More
@@ -120,11 +120,27 b' class Client(HasTraits):' | |||||
120 | [Default: 'default'] |
|
120 | [Default: 'default'] | |
121 | context : zmq.Context |
|
121 | context : zmq.Context | |
122 | Pass an existing zmq.Context instance, otherwise the client will create its own. |
|
122 | Pass an existing zmq.Context instance, otherwise the client will create its own. | |
123 | username : bytes |
|
|||
124 | set username to be passed to the Session object |
|
|||
125 | debug : bool |
|
123 | debug : bool | |
126 | flag for lots of message printing for debug purposes |
|
124 | flag for lots of message printing for debug purposes | |
|
125 | timeout : int/float | |||
|
126 | time (in seconds) to wait for connection replies from the Hub | |||
|
127 | [Default: 10] | |||
127 |
|
128 | |||
|
129 | #-------------- session related args ---------------- | |||
|
130 | ||||
|
131 | config : Config object | |||
|
132 | If specified, this will be relayed to the Session for configuration | |||
|
133 | username : str | |||
|
134 | set username for the session object | |||
|
135 | packer : str (import_string) or callable | |||
|
136 | Can be either the simple keyword 'json' or 'pickle', or an import_string to a | |||
|
137 | function to serialize messages. Must support same input as | |||
|
138 | JSON, and output must be bytes. | |||
|
139 | You can pass a callable directly as `pack` | |||
|
140 | unpacker : str (import_string) or callable | |||
|
141 | The inverse of packer. Only necessary if packer is specified as *not* one | |||
|
142 | of 'json' or 'pickle'. | |||
|
143 | ||||
128 | #-------------- ssh related args ---------------- |
|
144 | #-------------- ssh related args ---------------- | |
129 | # These are args for configuring the ssh tunnel to be used |
|
145 | # These are args for configuring the ssh tunnel to be used | |
130 | # credentials are used to forward connections over ssh to the Controller |
|
146 | # credentials are used to forward connections over ssh to the Controller | |
@@ -150,9 +166,10 b' class Client(HasTraits):' | |||||
150 |
|
166 | |||
151 | ------- exec authentication args ------- |
|
167 | ------- exec authentication args ------- | |
152 | If even localhost is untrusted, you can have some protection against |
|
168 | If even localhost is untrusted, you can have some protection against | |
153 |
unauthorized execution by |
|
169 | unauthorized execution by signing messages with HMAC digests. | |
154 |
as cleartext, so if someone can snoop your |
|
170 | Messages are still sent as cleartext, so if someone can snoop your | |
155 | not help against malicious attacks. |
|
171 | loopback traffic this will not protect your privacy, but will prevent | |
|
172 | unauthorized execution. | |||
156 |
|
173 | |||
157 | exec_key : str |
|
174 | exec_key : str | |
158 | an authentication key or file containing a key |
|
175 | an authentication key or file containing a key | |
@@ -236,9 +253,9 b' class Client(HasTraits):' | |||||
236 | _ignored_hub_replies=Int(0) |
|
253 | _ignored_hub_replies=Int(0) | |
237 |
|
254 | |||
238 | def __init__(self, url_or_file=None, profile='default', profile_dir=None, ipython_dir=None, |
|
255 | def __init__(self, url_or_file=None, profile='default', profile_dir=None, ipython_dir=None, | |
239 |
context |
|
256 | context=None, debug=False, exec_key=None, | |
240 | sshserver=None, sshkey=None, password=None, paramiko=None, |
|
257 | sshserver=None, sshkey=None, password=None, paramiko=None, | |
241 | timeout=10 |
|
258 | timeout=10, **extra_args | |
242 | ): |
|
259 | ): | |
243 | super(Client, self).__init__(debug=debug, profile=profile) |
|
260 | super(Client, self).__init__(debug=debug, profile=profile) | |
244 | if context is None: |
|
261 | if context is None: | |
@@ -289,15 +306,15 b' class Client(HasTraits):' | |||||
289 | else: |
|
306 | else: | |
290 | password = getpass("SSH Password for %s: "%sshserver) |
|
307 | password = getpass("SSH Password for %s: "%sshserver) | |
291 | ssh_kwargs = dict(keyfile=sshkey, password=password, paramiko=paramiko) |
|
308 | ssh_kwargs = dict(keyfile=sshkey, password=password, paramiko=paramiko) | |
292 | if exec_key is not None and os.path.isfile(exec_key): |
|
309 | ||
293 | arg = 'keyfile' |
|
310 | # configure and construct the session | |
294 | else: |
|
311 | if exec_key is not None: | |
295 | arg = 'key' |
|
312 | if os.path.isfile(exec_key): | |
296 |
|
|
313 | extra_args['keyfile'] = exec_key | |
297 | if username is None: |
|
314 | else: | |
298 | self.session = Session(**key_arg) |
|
315 | extra_args['key'] = exec_key | |
299 | else: |
|
316 | self.session = Session(**extra_args) | |
300 | self.session = Session(username=username, **key_arg) |
|
317 | ||
301 | self._query_socket = self._context.socket(zmq.XREQ) |
|
318 | self._query_socket = self._context.socket(zmq.XREQ) | |
302 | self._query_socket.setsockopt(zmq.IDENTITY, self.session.session) |
|
319 | self._query_socket.setsockopt(zmq.IDENTITY, self.session.session) | |
303 | if self._ssh: |
|
320 | if self._ssh: |
General Comments 0
You need to be logged in to leave comments.
Login now