How to request.get file from FILE directory using Domino API

sean.mcclure
sean.mcclure Member Posts: 2
edited November 2020 in Q&A

Trying to figure out how to read data from the FILE directory in a Domino Project, through a published Model API.

I am currently using the Domino API to make a request, since any python invoked by the model API is inside an executor at runtime, and thus doesn't have direct access to the FILE directory.

This is my code:


from domino import Domino

import requests

def fetch_file(filename):

headers = {'X-Domino-Api-Key': 'my_api_key'}

request = requests.get('https://domino.my_comp_url.com/v1/projects/my_username/project_name/data/' + filename + '.json', headers=headers, verify=False)

return(request)

But this doesn't work. Domino API seems to suggest using Blobs, but I would need the Blob ID and not sure where to find that.

Comments

  • katie.shakman
    katie.shakman Administrator, Domino Posts: 257 admin

    Hi @sean.mcclure,

    I noticed this was still open -- from our records I believe you worked with @akshay.ambekar to resolve your model API usage questions. Indeed, by default your model can access files in the Domino project directly by path, as those files are included when the model container is built. If you still have any issues accessing files from your model APIs please let us know.

    Katie

    Field Data Scientist @ Domino

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!