Skip to content

Upload session query method compatible with memoryfs python library #656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2023
Merged

Upload session query method compatible with memoryfs python library #656

merged 1 commit into from
Mar 6, 2023

Conversation

brunoabreu0
Copy link
Contributor

Python's memoryfs library handles reading and writing memory files. The open method from MemoryFS class instantiate a MemoryFile object.

MemoryFile class inherits from io.RawIOBase class, thus it can be passed to the file_object parameter of the create_upload_session_query method.

However, MemoryFile does not implements the method fileno() (used on the line 34, to get file_size), also, the method os.path.basename() (used on the line 35 to get file_name) cannot parse MemoryFS paths.

As a solution to turn create_upload_session_query method compatible, I added 2 optional parameters file_size and file_name, so IO objects (as MemoryFile objects) can provide them from the outside of method.

This solution does not break the current usage of the method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants