attachment-downloader
attachment-downloader copied to clipboard
jinja2 for date-after and date-before
Good job!
- You can customise the download filename using a jinja2 template for the argument
--filename-template.Is it possible a jinja2 template to add for argument--date-after.Example:--date-after="{{date.strftime(%Y-%m-%dT00:00:00')}}" - How can I access from the Python programming language to attachment-downloader as in yt-dlp. Example:
import yt_dlp
ydl_opts = {
'format': format_selector,
}
- I'm new to python, please forgive me if the questions are inappropriate. Thank you!
Hi @viktordino
What the use-case/justification for needing the date after exposed in the filename template?
Unfortunately I don't understand you 2nd question? Are you asking how you can use attcachement-downloader from within another python script?
I'm new to python, please forgive me if the questions are inappropriate. Thank you!
No problem at all! We all have to go through the learning process at some point!
Cheers, James
1.Unfortunately I don't understand you 2nd question? Are you asking how you can use attcachement-downloader from within another python script? I found the answer to the question:
Attachment downloader is designed to be used as a command line application, it's not designed to be used as a library within a script. jamesridgway/attachment-downloader/issues/19
2.If I don't select Date Filtering, what period does the loader select?
How can you use a variable with today's date in an argument?
Example:
--date-after datetime.now()
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
2.If I don't select Date Filtering, what period does the loader select? How can you use a variable with today's date in an argument?
If you don't specify a date filter, no date filter will be applied whatsoever and everything that matches any other criteria
With regards to how you would pass in the current date, that depends on how you invoke the library. If you use it as a CLI tool as intended they you're probably better off trying to use your shell environment to pass in the value.
For example, if you're working on linux then you'd want to do something like this:
attachment-downloader --host imap.example.com --username [email protected] --password pa55word --date-after "$(date +"%Y-%m-%dT%H:%M:%S")" --output ~/Downloads
In the above example "$(date +"%Y-%m-%dT%H:%M:%S")" is used to return the current time in the format that attachment-downloader expects
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.