API 5.0 WP4.3: Handling of files in local mode#2223
API 5.0 WP4.3: Handling of files in local mode#2223Bibo-Joshi merged 10 commits intoapi-5.0-masterfrom
Conversation
|
Theoretically this is ready for review.
If I get to it before this is reviewed and merged, I'll try to add the |
|
Update: @Poolitzer tested the local file get & download behaviour on local bot apis on both windows and ubuntu. I just pushed a commit to also allow passing (relative) local paths to send files. Mock-tests succeed (at least locally for me), will double check on ubuntu in a moment. |
|
Tested |
| return False | ||
|
|
||
| path = Path(obj) if isinstance(obj, str) else obj | ||
| try: |
There was a problem hiding this comment.
Path('https://some-domain.org').is_file() throws an error instead of returning False …
There was a problem hiding this comment.
hehe so we could do
try:
path.is_file()
return True
except Exception:
return Falsethats funny :D
There was a problem hiding this comment.
nah, path.is_file() can still return False if the passed string looks like a valid path but the file doesn't exist
Poolitzer
left a comment
There was a problem hiding this comment.
Small doc suggestions. Code looks good!
| return False | ||
|
|
||
| path = Path(obj) if isinstance(obj, str) else obj | ||
| try: |
There was a problem hiding this comment.
hehe so we could do
try:
path.is_file()
return True
except Exception:
return Falsethats funny :D
Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
# Conflicts: # telegram/files/inputmedia.py
pathlib.Pathobjects instead of strings