MCPcopy Create free account
hub / github.com/diffgram/diffgram / api_project_input_from_local

Function api_project_input_from_local

walrus/methods/input/upload_api.py:63–148  ·  view source on GitHub ↗
(project_string_id)

Source from the content-addressed store, hash-verified

61 apis_user_list = ['api_enabled_builder',
62 'security_email_verified'])
63def api_project_input_from_local(project_string_id):
64 try:
65 json_parsed = json.loads(request.form.get('json'))
66 except:
67 temp_log = regular_log.default_api_log()
68 temp_log["error"]["input"] = "Expecting a key 'json' in form request."
69 return jsonify(log = temp_log), 400
70
71 spec_list = [
72 {"directory_id": {
73 'default': None,
74 'kind': int,
75 'required': False
76 }},
77 {"parent_file_id": {
78 'default': None,
79 'kind': int,
80 'required': False
81 }},
82 {'ordinal': {
83 "required": False,
84 "kind": int
85 }},
86 {"instance_list": {
87 'default': None,
88 'kind': list,
89 'allow_empty': True,
90 'required': False
91 }
92 },
93 {"frame_packet_map": { # WIP
94 'default': None,
95 'kind': dict,
96 'required': False
97 },
98 }
99 ]
100
101 log, input, untrusted_input = regular_input.master(
102 request = request,
103 spec_list = spec_list,
104 untrusted_input = json_parsed)
105
106 if len(log["error"].keys()) >= 1:
107 return jsonify(log = log), 400
108
109 with sessionMaker.session_scope() as session:
110
111 project = Project.get(session, project_string_id)
112
113 directory = WorkingDir.get_with_fallback(
114 session = session,
115 project = project,
116 directory_id = input.get('directory_id')
117 )
118 if directory is False:
119 log['error'] = f"Bad directory_id: {input.get('directory_id')}"
120 return jsonify(log = log), 400

Callers

nothing calls this directly

Calls 4

get_with_fallbackMethod · 0.80
input_from_localMethod · 0.80
getMethod · 0.45
serializeMethod · 0.45

Tested by

no test coverage detected