Esempio n. 1
0
def test_ftp_connection_info(netrcfile):
    """Test unzipping of xml files using zipfile and tmpdir fixtures."""
    url, info = ftp_connection_info('ftp.example.com', netrcfile)
    assert url == 'ftp.example.com'
    assert 'ftp_user' in info
    assert info['ftp_user'] == 'test'
    assert 'ftp_password' in info
    assert info['ftp_password'] == 'test'
Esempio n. 2
0
def test_ftp_connection_info(netrcfile):
    """Test unzipping of xml files using zipfile and tmpdir fixtures."""
    url, info = ftp_connection_info('ftp.example.com', netrcfile)
    assert url == 'ftp.example.com'
    assert 'ftp_user' in info
    assert info['ftp_user'] == 'test'
    assert 'ftp_password' in info
    assert info['ftp_password'] == 'test'
Esempio n. 3
0
 def _get_ftp_timestamp(cls, spider, url):
     ftp_host, params = ftp_connection_info(
         spider.ftp_host,
         spider.ftp_netrc,
     )
     ftp = FTP(
         host=ftp_host,
         user=params['ftp_user'],
         passwd=params['ftp_password'],
     )
     return ftp.sendcmd('MDTM {}'.format(
         cls._get_ftp_relative_path(url=url, host=ftp_host)))
Esempio n. 4
0
 def _get_ftp_timestamp(cls, spider, url):
     ftp_host, params = ftp_connection_info(
         spider.ftp_host,
         spider.ftp_netrc,
     )
     ftp = FTP(
         host=ftp_host,
         user=params['ftp_user'],
         passwd=params['ftp_password'],
     )
     return ftp.sendcmd(
         'MDTM {}'.format(
             cls._get_ftp_relative_path(
                 url=url,
                 host=ftp_host
             )
         )
     )