roboflow / roboflow/roboflow-python

Clarity between `hosted_image` and `is_hosted` in `Project.upload`

Open
#233 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
629
Forks
140
Avg merge
2d 2h
Merged PRs (30d)
5

Description

I find it confusing that in Project.upload there's both a hosted_image: boolargument set by the user, and an internal is_hosted, that determines which errors may be thrown.

By setting hosted_image it's possible to bypass checks and send the image to Roboflow, which promptly returns a 500 code.

Still, maybe there's a reason behind it?

Test code:

import roboflow

img_path = "<path_to_img>"
rf = roboflow.Roboflow(api_key="API_KEY")

workspace_id = "<ws ID>"
project_id = "<proj ID>"
workspace = rf.workspace(workspace_id)
project = workspace.project(project_id)

project.upload(img_path, hosted_image=True)

This raises:

File  ... /roboflow/adapters/rfapi.py:90, in upload_image(api_key, project_url, image_path, hosted_image, split, batch_name, tag_names, sequence_number, sequence_size, **kwargs)
UploadError: Bad response: 500: {'error': 'Unknown error'}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Project.upload and roboflow/adapters/rfapi.py:90, where upload_image is reported to raise UploadError after a 500 response. Trace how hosted_image and internal is_hosted are interpreted and compare the validation and error paths. Done means their distinction and expected behavior are explicit, and the shown call no longer bypasses checks into an unexplained server error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend-api-design, computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.