# It is possible to get access to a ftp server on connectport X2 with python?

**URL:** <https://forums.digi.com/t/it-is-possible-to-get-access-to-a-ftp-server-on-connectport-x2-with-python/14025>\
**Category:** Python\
**Tags:** ftp, x2, connectport\
**Created:** [December 3, 2014, 6:40am UTC](https://forums.digi.com/t/it-is-possible-to-get-access-to-a-ftp-server-on-connectport-x2-with-python/14025 "2014-12-03T06:40:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evanior](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@Evanior](https://forums.digi.com/u/Evanior)\
**Post date:** [December 3, 2014, 6:40am UTC](https://forums.digi.com/t/it-is-possible-to-get-access-to-a-ftp-server-on-connectport-x2-with-python/14025/1 "2014-12-03T06:40:52Z")

</div>

from ftplib import FTP  
ftp = FTP(‘ftp.server’)  
ftp.login(‘user’, ‘password’)

print ftp.dir()

---

<div class="post-metadata">

**Author:** ![kjensen8](https://avatars.discourse-cdn.com/v4/letter/k/8e8cbc/32.png) [@kjensen8](https://forums.digi.com/u/kjensen8)\
**Post date:** [December 3, 2014, 4:19pm UTC](https://forums.digi.com/t/it-is-possible-to-get-access-to-a-ftp-server-on-connectport-x2-with-python/14025/2 "2014-12-03T16:19:31Z")

</div>

I don’t see why not.

Here is something with a little more detail:  
try:  
f = FileWrapper(buf, len(buf))

```
    cmd = "STOR " + fname

    ftp = FTP(ftpserver)
    # uncomment for debug
    ftp.set_debuglevel(2)
    ftp.set_pasv('true')
    ftp.login(ftpuser, ftppwd)

    ftp.cwd(ftpdir)

    ftp.storbinary(cmd, f)

    ftp.quit()
    ret = True

```

---

<div class="post-metadata">

**Author:** ![trooper2](https://avatars.discourse-cdn.com/v4/letter/t/edb3f5/32.png) [@trooper2](https://forums.digi.com/u/trooper2)\
**Post date:** [December 3, 2014, 4:37pm UTC](https://forums.digi.com/t/it-is-possible-to-get-access-to-a-ftp-server-on-connectport-x2-with-python/14025/3 "2014-12-03T16:37:45Z")

</div>

See the samples in Digi ESP for Python. There are several FTP samples. Check readme.txt in each sample project.
