omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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.


    QNAP NAS - File Station (Code)

    Pythonista
    3
    9
    6778
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • parkerc
      parkerc last edited by

      Hi, I am a complete novice when it comes to programming, but I do my best to try and pick up new things, and the reason I bought Pythonista was because I saw a github post where someone had posted some python scripts on how to work with a QNAP)

      https://github.com/mdhorda/qnap/

      But while I have copied an pasted the content over, into a new folder called QNAP, it does not seem to work ?

      I'm particularly interested in one of the python scripts here - > https://github.com/mdhorda/qnap/blob/master/get_sid.py as I want to find a way that it can be run, so it asked me for me password and encodes it for me etc.

      Any help would be appreciated

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        Add these lines to the bottom of get_sid.py and run it.

        if __name__ == '__main__':
            import console
            print(ezEncode(console.password_alert('Enter your password')))
        
        1 Reply Last reply Reply Quote 0
        • parkerc
          parkerc last edited by

          Many thanks !!

          Any help you could give me on making the rest of it work would be appreciated..

          1 Reply Last reply Reply Quote 0
          • brumm
            brumm last edited by brumm

            Hi parkerc,

            first you should download all py files in the same dir (site-packages or where you write your qnap program). Then you have to write your program (not in site-packages dir). Btw. I don't own a QNAP so I can't test it...

            from filestation import *
            
            #and now follow the README.md sample
            host = 'your_host_or_ip_addr'
            user = 'your_user'
            password = 'your_password'
            
            filestation = FileStation(host, user, password)
            shares = filestation.list_share()
            #and now you should start with list or search command...
            

            edit: First line corrected.

            1 Reply Last reply Reply Quote 0
            • parkerc
              parkerc last edited by parkerc

              Hi,

              Thanks for the update ;)

              Ok, I've copied everything I could from that GitHub post in to a folder called QNAP, and then created a new script with what you had provided above and put that outside.

              So I now have a new qnaprun.py file next to the QNAP folder.

              However - When I run the qnaprun.py script I get an immediate "syntaxerror : invalid syntax on the first line ? Which is

              from filestation import

              **** I understand you do not have a QNAP, hence your support is very much appreciated** .

              1 Reply Last reply Reply Quote 0
              • brumm
                brumm last edited by brumm

                I can't see a * at the end of the first line!?
                And if you don't use the site-packages dir, your code have to be in the same dir (QNAP).
                modules

                1 Reply Last reply Reply Quote 1
                • brumm
                  brumm last edited by brumm

                  I tested it with my localhost and it shows an expected error.

                  ERROR:root:GET error: http://127.0.0.1:8080/cgi-bin/authLogin.cgi?pwd=eW91cl9wYXNzd29yZA==&user=your_user
                  ...

                  So it should work with a Qnap at the other side.

                  1 Reply Last reply Reply Quote 0
                  • parkerc
                    parkerc last edited by

                    Hi, I have put everything into the same folder now (called Qnap ) but whenever I run that file I continue to get the same syntax error on the first line - yet there is a file in the folder called filestation.py ?

                    Here is the qnaprun.py

                    from filestation import
                    
                    #and now follow the README.md sample
                    host = '10.168.1.111'
                    user = 'your_user'
                    password = 'your_password'
                    
                    filestation = FileStation(host, user, password)
                    shares = filestation.list_share()
                    #and now you should start with list or search command...
                    
                    1 Reply Last reply Reply Quote 0
                    • ccc
                      ccc last edited by

                      Add an * to the end of that the first line.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Powered by NodeBB Forums | Contributors