Skip to content

Commit ee635f5

Browse files
committed
Put supported domains list into separate file
1 parent c05f146 commit ee635f5

2 files changed

Lines changed: 34 additions & 8 deletions

File tree

oshminer/main.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from fastapi.responses import JSONResponse
1010
from pydantic import BaseModel, HttpUrl
1111

12+
import oshminer.supported_domains
1213
class Item(BaseModel):
1314
name: str
1415
description: Optional[str] = None
@@ -19,13 +20,6 @@ class MiningRequest(BaseModel):
1920
repo_urls: Set[HttpUrl] = set()
2021
requested_data: Set[str] = set()
2122

22-
# Supported hosting platforms as a list of their domains.
23-
# `repo_urls` need to include one of these domains.
24-
supported_domains: list = [
25-
"github.com",
26-
"wikifactory.com"
27-
]
28-
2923
# Supported data-mining request types. Items in `required_data` must
3024
# be from this list.
3125
supported_data_requests: list = [
@@ -145,4 +139,25 @@ async def mining_request(request_body: MiningRequest):
145139
else:
146140
repo_dict["requested_data"][data_item] = ""
147141
response.append(repo_dict)
148-
return response
142+
return response
143+
144+
145+
146+
147+
148+
149+
150+
151+
152+
153+
154+
"""
155+
1. get `list` of requested info
156+
2. compile API request
157+
2.1 get needed API requests for each item in `list`
158+
2.2 deduplicate into list of what's needed from API
159+
2.3 create API call
160+
2.4 make API call
161+
3. interpret and derive info from API response
162+
4. send our own response
163+
"""

oshminer/supported_domains.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# SPDX-FileCopyrightText: 2022 Pen-Yuan Hsing
4+
# SPDX-License-Identifier: AGPL-3.0-or-later
5+
6+
# Supported hosting platforms as a list of their domains.
7+
# `repo_urls` need to include one of these domains.
8+
supported_domains: list = [
9+
"github.com",
10+
"wikifactory.com"
11+
]

0 commit comments

Comments
 (0)