MCPcopy Create free account
hub / github.com/apple/coremltools / __api_GET

Method __api_GET

mlmodel/docs/readme_session.py:48–67  ·  view source on GitHub ↗
(self, endpoint, print_info=None, paginated=False)

Source from the content-addressed store, hash-verified

46 # API GET call.
47 # If paginated, gather and concat the output for each page in the endpoint.
48 def __api_GET(self, endpoint, print_info=None, paginated=False):
49 if not print_info:
50 print_info = "API::GET(" + endpoint + ")"
51 if paginated:
52 i = 1
53 out = []
54 while True:
55 response = self.__api_call(
56 requests.get,
57 endpoint + "?page=" + str(i),
58 print_info + " (page " + str(i) + ")",
59 )
60 if response is None:
61 return None
62 if len(response) == 0:
63 return out
64 out += response
65 i += 1
66 else:
67 return self.__api_call(requests.get, endpoint, print_info)
68
69 # API POST call.
70 # Data should be passed in as a map. The map will be converted to string.

Callers 3

__refresh_versionsMethod · 0.95
__refresh_categoriesMethod · 0.95

Calls 3

__api_callMethod · 0.95
strClass · 0.50
lenFunction · 0.50

Tested by

no test coverage detected