我必须在我的代码中导入我的config.py文件,然后基本上将REPOS_TO_CHECK值传递给一个函数,该函数应该是一个列表的形式,这样当我将列表传递给我的build_url函数时,它生成一个url时REPOS_TO_CHECK变量从config.py文件
传递给它我必须像GET / repos /:owner /:repo一样生成网址 GITHUB_URL =' https://testurl.com'
如何将config.py文件中的REPOS_TO_CHECK参数作为列表传递,以便在传递时
def build_url(['owner','repo']):
生成的网址为https://testurl.com/:owner/:repo
:owner, :repo are in the REPOS_TO_CHECK in the config.py file.
我可以通过在我的代码中导入config.py然后使用config访问值来访问config.py文件。 for example: config.GITHUB_URL ,gives me 'https://testurl.com'
这是我的配置文件:
GITHUB_URL = 'https://testurl.com'
GITHUB_ACCESS_TOKEN = 'access token'
REPOS_TO_CHECK = [
('owner1', 'repo1'),
('owner2', 'repo2'),]