diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2020-10-22 01:34:08 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2020-10-22 01:34:08 +0200 |
commit | d669ee4dd2244880a7c8acc64a0c3df9532922dc (patch) | |
tree | 2624a5b9c4bae3b917ba82a41373bbb22778f921 /fuzzycat | |
parent | 03f9d780824bd6a7015633d733326c2cae45c66b (diff) | |
download | fuzzycat-d669ee4dd2244880a7c8acc64a0c3df9532922dc.tar.gz fuzzycat-d669ee4dd2244880a7c8acc64a0c3df9532922dc.zip |
wip: verify
Diffstat (limited to 'fuzzycat')
-rw-r--r-- | fuzzycat/verify.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/fuzzycat/verify.py b/fuzzycat/verify.py new file mode 100644 index 0000000..d4677b0 --- /dev/null +++ b/fuzzycat/verify.py @@ -0,0 +1,41 @@ +""" +Verification part of matching. + +We represent clusters as json lines. One example input line (prettified): + + { + "v": [ + "cjcpmod6pjaczbhrqfljdfl4m4", + "di5kdt5apfc6fiiqofjzkuiqey", + "fxhwvmc7dzc6bpuvo7ds4l5gx4", + "pda5cuevyrcmpgj3woxw7ktvz4", + "port5bx5nzb7tghqsjknnhs56y", + "x3a43yczavdkfhp3ekgt5hn6l4" + ], + "k": "1 Grundlagen", + "c": "t" + } + +Further steps: + +* fetch all releases, this might be via API, search index, some local key value +store, or some other cache +* apply various rules, return match status + +""" + +def fetch_release_entity(ident, api="https://api.fatcat.wiki/v0"): + """ + Fetches a single release entity. + """ + link = "https://api.fatcat.wiki/v0/release/{}".format(ident) + return requests.get(link).json() + +def ident_to_release_entities(ids): + """ + Turn a list of ids into release entities. + """ + return [fetch_release_entity(id) for id in ids] + + + |