KeyError: 'GET'
Closed this issue · 7 comments
I am trying to use this at conda/conda#682 to get FTP support for downloading. I am getting
File "/Users/aaronmeurer/Documents/Continuum/conda/conda/connection.py", line 172, in send
resp = self.func_table[request.method](path, request)
KeyError: 'GET'
(that corresponds to https://github.com/Lukasa/requests-ftp/blob/master/requests_ftp/ftp.py#L157).
Anyway way to support GET
? Do I just need to mount this differently? I am currently doing self.mount("ftp://", FTPAdapter())
in my Session
subclass.
Ah, so the FTP adapter uses the raw commands, not the ones exposed by FTP clients. The equivalent is actually RETR. You can make the adapter support GET by adding 'GET' to the func_table
.
It should do the same as what RETR
does.
So 'GET': self.retr
wants to have some username and password.
If I add self.conn.login()
before code = self.conn.retrbinary('RETR ' + path, data_callback_factory(data))
it works. Is this a good idea?
If you pass an Auth tuple to conn.get it'll work, I think. Just pass a tuple of empty strings.
I really have no idea about any of this. I'll just submit a PR and you can tell me if I am doing something stupid.
=) Sure.