Issue
I try to upload scv to ftp. How I see where are 2 ways: FEED_FORMAT + FEED_URI and FEEDS.
My settings.py with first way connecting to FTP but doesn't upload file. I get error 550. And also it's deprecated.
FEED_FORMAT = 'csv'
FEED_URI = 'ftp://***/files/file.csv'
So I try to use FEEDS. I read this https://docs.scrapy.org/en/latest/topics/feed-exports.html#std-setting-FEEDS a many times and searched examples here and asks at official Discord with no answer. This part is works and create file:
FEEDS = {
pathlib.Path('file.csv'): {
'format': 'csv',
}
}
I need to write FTP login and pass for FEEDS but I don't know how. I tried this and it's doesn't work:
FEED_STORAGES = {
'ftp': 'ftp://****/files/file.csv',
}
I tried something like this and it's doesn't work too:
FEEDS = {
pathlib.Path('file.csv'): {
'format': 'csv',
}
'ftp': 'ftp://****/files/file.csv',
}
I think it's a quite simple question because got answers like "read the doc" but I'm stuck here.
So first question can I write login and pass in settings.py? Or maybe after deprecated FEED_FORMAT and FEED_URI it's should be in another file.
And second question how to write login and pass to FTP for FEEDS. I realy need syntax here not link for this docs https://docs.scrapy.org/ because I read it all. If question in fact is realy hard I would appreciate for link to another docs which not copypaste official.
Solution
I get error 550.
From what I can tell, that error means the path you're trying to use doesn't exist, or you don't have the permissions to access it.
I would recommend checking the path and/or your credentials.
But keep reading if you want to try using FEEDS
instead.
The docs do show an example of what you want: https://docs.scrapy.org/en/latest/topics/feed-exports.html#feeds
But to simplify that code even more, a minimal example would be something like:
FEEDS = {
'ftp://****/files/file.csv': {
'format': 'csv',
},
}
Of course, you can add additional options if you want to modify the defaults.
Answered By - stranac
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.