You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add support for files endpoint
* add readme
* fix readme
* nit
* simplify upload endpoint
* Extended Readme with a task payload example
Co-authored-by: Fatih Kurtoglu <fatih.kurtoglu@scale.com>
Files are a way of uploading local files directly to Scale storage or importing files before creating tasks.
344
+
345
+
The ``file.attachment_url`` can be used in place of attachments in task payload.
346
+
347
+
Upload Files
348
+
^^^^^^^^^^^^^^
349
+
350
+
Upload a file. Check out `Scale's API documentation`__ for more information.
351
+
352
+
__https://docs.scale.com/reference#file-upload-1
353
+
354
+
.. code-block:: python
355
+
356
+
withopen(file_name, 'rb') as f:
357
+
my_file = client.upload_file(
358
+
file=f,
359
+
project_name="test_project",
360
+
)
361
+
362
+
Import Files
363
+
^^^^^^^^^^^^^^
364
+
365
+
Import a file from a URL. Check out `Scale's API documentation`__ for more information.
366
+
367
+
__https://docs.scale.com/reference#file-import-1
368
+
369
+
.. code-block:: python
370
+
371
+
my_file = client.import_file(
372
+
file_url="http://i.imgur.com/v4cBreD.jpg",
373
+
project_name="test_project",
374
+
)
375
+
376
+
377
+
After the files are successfully uploaded to Scale's storage, you can access the URL as ``my_file.attachment_url``, which will have a prefix like ``scaledata://``.
378
+
379
+
The attribute can be passed to the task payloads, in the ``attachment`` parameter.
0 commit comments