Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the ftp API #40

Merged
merged 5 commits into from
Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions aiofreepybox/aiofreepybox.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from aiofreepybox.api.lan import Lan
from aiofreepybox.api.wifi import Wifi
from aiofreepybox.api.phone import Phone
from aiofreepybox.api.ftp import Ftp
from aiofreepybox.api.fs import Fs
from aiofreepybox.api.call import Call
from aiofreepybox.api.connection import Connection
Expand Down Expand Up @@ -80,6 +81,7 @@ async def open(self, host, port):
self.lan = Lan(self._access)
self.wifi = Wifi(self._access)
self.phone = Phone(self._access)
self.ftp = Ftp(self._access)
self.fs = Fs(self._access)
self.call = Call(self._access)
self.connection = Connection(self._access)
Expand Down
30 changes: 30 additions & 0 deletions aiofreepybox/api/ftp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class Ftp:
"""
Ftp
"""

def __init__(self, access):
self._access = access

ftp_configuration_schema = {
"enabled": False,
"allow_anonymous": False,
"allow_anonymous_write": False,
"allow_remote_access": False,
"remote_domain": "",
"password": "",
"port_ctrl": 12345,
"port_data": 45678,
}

async def get_ftp_configuration(self):
"""
Get ftp configuration
"""
return await self._access.get("ftp/config/")

async def set_ftp_configuration(self, ftp_configuration):
"""
Set ftp configuration
"""
return await self._access.put("ftp/config/", ftp_configuration)