MCPcopy Create free account
hub / github.com/N4si/microservices-python-app / upload

Function upload

src/gateway-service/storage/util.py:4–29  ·  view source on GitHub ↗
(f, fs, channel, access)

Source from the content-addressed store, hash-verified

2
3
4def upload(f, fs, channel, access):
5 try:
6 fid = fs.put(f)
7 except Exception as err:
8 print(err)
9 return "internal server error, fs level", 500
10
11 message = {
12 "video_fid": str(fid),
13 "mp3_fid": None,
14 "username": access["username"],
15 }
16
17 try:
18 channel.basic_publish(
19 exchange="",
20 routing_key="video",
21 body=json.dumps(message),
22 properties=pika.BasicProperties(
23 delivery_mode=pika.spec.PERSISTENT_DELIVERY_MODE
24 ),
25 )
26 except Exception as err:
27 print(err)
28 fs.delete(fid)
29 return f"internal server error rabbitmq issue, {err}", 500

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected