import pysftp
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
# The <hostname> can be in either of the following formats: ftp.domain.ca || http://ftp.domain.ca
with pysftp.Connection('<hostname>', username='xxxx', password='xxxxxx', cnopts=cnopts) as sftp:
# Change to the dictory 'public'
with sftp.cd('public'):
# Fetch the remote file
sftp.get('<remote_file_name>')
# Upload the same file to a remote location
sftp.put('<local_file_name>')
PY
HTTP 要求の作成
HTTP ライブラリ requests を使用し、合成スクリプト内で HTTP 要求を行うことができます。次に、公開 GitHub イベント API に GET 要求を行う例を示します。ライブラリの機能と使用に関する詳細については、「要求:Humans™ の HTTP」を参照してください。