def _h(): """Create authorization header with API key""" return {"Authorization": "Bearer " + get_api_key(), "x-jovian-source": "library", "x-jovian-library-version": __version__, "x-jovian-guest": get_guest_key(), "x-jovian-org": read_org_id()}
def _h(): """Create a header to provide library metadata""" return {"Authorization": "Bearer " + get_api_key(), "x-jovian-source": "library", "x-jovian-library-version": __version__, "x-jovian-command": "add-slack", "x-jovian-guest": get_guest_key(), "x-jovian-org": read_org_id()}
def _h(fresh): """Create a header to provide library metadata""" api_key, _ = read_api_key_opt() headers = {"x-jovian-source": "library", "x-jovian-library-version": __version__, "x-jovian-command": "clone" if fresh else "pull", "x-jovian-guest": get_guest_key(), "x-jovian-org": read_org_id()} if api_key is not None: headers["Authorization"] = "Bearer " + api_key return headers
def test_ensure_org_some_creds_exist_default_org_id( self, mock_is_flavor_pro, mock_request_org_id, mock_requests_get): with fake_creds('.jovian-some-creds', 'credentials.json'): # setUp creds = { "WEBAPP_URL": "https://staging.jovian.ml/", "GUEST_KEY": "b6538d4dfde04fcf993463a828a9cec6", "API_URL": "https://api-staging.jovian.ai" } write_creds(creds) ensure_org() assert read_api_url() == "https://api.jovian.ai" assert read_org_id() == "public" assert read_webapp_url() == "https://jovian.ml/"
def test_read_org_id(): with fake_creds(): write_org_id("fake_org_id") assert read_org_id() == "fake_org_id"
def test_read_org_id(): with fake_creds('.jovian-write-api-url', 'credentials.json'): write_org_id("fake_org_id") assert read_org_id() == "fake_org_id"