File size: 389 Bytes
5564ecb
 
13a6e1e
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import json

with open("static/files/origin-codes.json", "r", encoding="utf-8") as file:
    origin_codes = json.load(file)

def get_origin_id_and_code(origin: str):
    for x in origin_codes:
        if x and x.get("name"):
            if origin == x["name"]:
                    id = x["id"],
                    code = x["code"]
                    return id, code
    return None, None