MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / storlines

Method storlines

tools/python-3.11.9-amd64/Lib/ftplib.py:511–540  ·  view source on GitHub ↗

Store a file in line mode. A new port is created for you. Args: cmd: A STOR command. fp: A file-like object with a readline() method. callback: An optional single parameter callable that is called on each line after it is sent. [defa

(self, cmd, fp, callback=None)

Source from the content-addressed store, hash-verified

509 return self.voidresp()
510
511 def storlines(self, cmd, fp, callback=None):
512 """Store a file in line mode. A new port is created for you.
513
514 Args:
515 cmd: A STOR command.
516 fp: A file-like object with a readline() method.
517 callback: An optional single parameter callable that is called on
518 each line after it is sent. [default: None]
519
520 Returns:
521 The response code.
522 """
523 self.voidcmd('TYPE A')
524 with self.transfercmd(cmd) as conn:
525 while 1:
526 buf = fp.readline(self.maxline + 1)
527 if len(buf) > self.maxline:
528 raise Error("got more than %d bytes" % self.maxline)
529 if not buf:
530 break
531 if buf[-2:] != B_CRLF:
532 if buf[-1] in B_CRLF: buf = buf[:-1]
533 buf = buf + B_CRLF
534 conn.sendall(buf)
535 if callback:
536 callback(buf)
537 # shutdown ssl layer
538 if _SSLSocket is not None and isinstance(conn, _SSLSocket):
539 conn.unwrap()
540 return self.voidresp()
541
542 def acct(self, password):
543 '''Send new account name.'''

Callers

nothing calls this directly

Calls 8

voidcmdMethod · 0.95
transfercmdMethod · 0.95
voidrespMethod · 0.95
ErrorClass · 0.70
callbackFunction · 0.70
readlineMethod · 0.45
sendallMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected