Skip to content

Files

flowtask.services.files

Files.

File Management Infraestructure

FileManager

FileManager(request, *args, **kwargs)

Bases: BaseView

API View for managing Files.

delete async

delete()

DELETe Method. description: Deletes a File (if exists) on Directory tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json

get async

get()
GET Method.

description: Managing Files. tags: - File Manager consumes: - application/json produces: - application/json

get_response async

get_response(headers)

Returns a valid Web.Response

head async

head()

HEAD Method. description: Sent response about file exists or not. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json

post async

post()

POST Method. description: upload a file onto repository directory. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json

put async

put()

PUT Method. description: Create a new directory. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json

return_file async

return_file(filename, **kwargs)

Returns a File based on a Stream Response

FileService

Bases: BaseView

get async

get()

description: Get all the Files objects in the current scope and program summary: get the files information and attributes tags: - FileService produces: - application/json parameters: - name: user_id description: user id to filter in: path required: true type: integer - name: file_slug description: file slug in: path required: true type: string responses: "200": description: returns valid data "204": description: No data "403": description: Forbidden Call "404": description: Program o File not found "406": description: Query Error

put async

put()

PUT FileService. description: Upload a File and, optionally, running an associated Task Parameters: file_slug: slug of the file in TROC files table program_slug: associated program mimetype: optional mime-type, default csv module_id: optional module ID task: boolean in query-params to disable running task. long_running: query-param to attach a Task in a Thread Pool

valid_permission async

valid_permission(user_id, codename)

valid_permission. Check if the user have permission for one func on the system.

manager

FileManager.

Works with files, download, upload and delete files over FS using an API.

TODO: Send a data-preview (first 10 rows) of uploaded file TODO: html-template for Uploader preview with "back" button.

FileManager

FileManager(request, *args, **kwargs)

Bases: BaseView

API View for managing Files.

delete async
delete()

DELETe Method. description: Deletes a File (if exists) on Directory tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json

get async
get()
GET Method.

description: Managing Files. tags: - File Manager consumes: - application/json produces: - application/json

get_response async
get_response(headers)

Returns a valid Web.Response

head async
head()

HEAD Method. description: Sent response about file exists or not. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json

post async
post()

POST Method. description: upload a file onto repository directory. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json

put async
put()

PUT Method. description: Create a new directory. tags: - files - File Manager - filesystem - file consumes: - application/json produces: - application/json

return_file async
return_file(filename, **kwargs)

Returns a File based on a Stream Response

model

FileService DB Model.

Database Object Model for FileServices.

service

FileService.

Work with slug-based file definitions, upload, download, enable tasks, etc.

FileService

Bases: BaseView

get async
get()

description: Get all the Files objects in the current scope and program summary: get the files information and attributes tags: - FileService produces: - application/json parameters: - name: user_id description: user id to filter in: path required: true type: integer - name: file_slug description: file slug in: path required: true type: string responses: "200": description: returns valid data "204": description: No data "403": description: Forbidden Call "404": description: Program o File not found "406": description: Query Error

put async
put()

PUT FileService. description: Upload a File and, optionally, running an associated Task Parameters: file_slug: slug of the file in TROC files table program_slug: associated program mimetype: optional mime-type, default csv module_id: optional module ID task: boolean in query-params to disable running task. long_running: query-param to attach a Task in a Thread Pool

valid_permission async
valid_permission(user_id, codename)

valid_permission. Check if the user have permission for one func on the system.

FileUploaded

FileUploaded(post, mimetype=None)

FileUploaded. processing a FileField

valid_content
valid_content(**kwargs)

valid_content. check if is a valid content-type ex: if is a csv, json or excel, open with pandas, if txt with stream, if image, etc