omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. sebietter

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 2
    • Topics 1
    • Posts 2
    • Best 1
    • Controversial 0
    • Groups 0

    sebietter

    @sebietter

    1
    Reputation
    561
    Profile views
    2
    Posts
    2
    Followers
    0
    Following
    Joined Last Online

    sebietter Unfollow Follow

    Best posts made by sebietter

    • RE: Uploading an image using SFTP (paramiko)

      I don't know if anybody is even interested but as a little follow up I'd like to quickly explain how I was able to solve the problem. I simply saved the image to my Pythonista library and uploaded it from there:

      imgSaved = image.save(fileName)
      

      And then upload it using the sftp.put command:

      sftp.put(fileName, remoteFilePath + fileName)
      

      With os.remove(fileName) the file can finally be removed from the Pythonista library to keep everything clean.

      posted in Pythonista
      sebietter
      sebietter

    Latest posts made by sebietter

    • Uploading an image using SFTP (paramiko)

      I'm using paramiko to (successfully) connect to my server using SFTP. I tried to upload an image chosen via photos.pick_image() but can't get Pythonista to upload the image.

      My code:

      import paramiko
      import photos
      from io import BytesIO
      import urllib
      import datetime
      
      # SFTP Configuration
      
      host = 'MyHost'
      port = 22
      transport = paramiko.Transport((host, port))
      
      password = 'MyPassword"
      username = 'MyUsername'
      transport.connect(username = username, password = password)
      
      sftp = paramiko.SFTPClient.from_transport(transport)
      
      # Image & Link Setup
      
      today = datetime.datetime.now()
      image = photos.pick_image()
      print image
      fileName = 'ios'
      fileName = fileName + '_' + today.strftime("%Y-%m-%d-%H%M%S") + '.png'
      
      urlBase = 'myURL'
      encodedFileName = urllib.quote(fileName)
      print fileName
      
      remoteFilePath = 'MyPath'
      
      # Upload the image
      
      sftp.put(image, remoteFilePath + fileName)
      
      sftp.close()
      transport.close()
      print 'Upload done!'
      
      # Paste image link to clipboard
      
      clipboard.set(urlBase + encodedFileName)
      

      I'd be really grateful if one of you could explain me what I'm doing wrong and how I could solve my problem of not being able to upload an image.

      posted in Pythonista
      sebietter
      sebietter
    • RE: Uploading an image using SFTP (paramiko)

      I don't know if anybody is even interested but as a little follow up I'd like to quickly explain how I was able to solve the problem. I simply saved the image to my Pythonista library and uploaded it from there:

      imgSaved = image.save(fileName)
      

      And then upload it using the sftp.put command:

      sftp.put(fileName, remoteFilePath + fileName)
      

      With os.remove(fileName) the file can finally be removed from the Pythonista library to keep everything clean.

      posted in Pythonista
      sebietter
      sebietter