我是否可以将这个GraphQLAPI请求转换为可以在Python中作为json使用的格式?

我是否可以将这个GraphQLAPI请求转换为可以在Python中作为json使用的格式?,python,json,formatting,graphql,Python,Json,Formatting,Graphql,我是这个地区的一个无赖,需要一些帮助 我使用以下代码使用GithubV4API进行了GraphQL查询,以过滤搜索存储库。但是,我对输出格式不满意 query { search( type:REPOSITORY, query: """ stars:<1000 forks:>10 size:>2000 pushed:>=2019-08-01 created:>=2018-08-01

我是这个地区的一个无赖,需要一些帮助

我使用以下代码使用GithubV4API进行了GraphQL查询,以过滤搜索存储库。但是,我对输出格式不满意

query {
  search(
    type:REPOSITORY, 
    query: """
      stars:<1000
      forks:>10
      size:>2000
      pushed:>=2019-08-01
      created:>=2018-08-01

    """,
    last: 100
  ) {
    repos: edges {
      repo: node {
        ... on Repository {
          name
          description
          url
          owner{__typename}
          licenseInfo{name}
          watchers{watchers: totalCount}
          releases {releases: totalCount}
          forks: forkCount
          pullRequests {pullRequests: totalCount}
          stargazers {stars: totalCount}
          openIssues: issues(states:OPEN){totalCount}
          totalIssues: issues {totalIssues: totalCount}
          primaryLanguage {primaryLanguage: name}
          languages(first: 3) { nodes {name} }
          repositoryTopics(first: 3) {nodes {topic {name}}}
          createdAt
          pushedAt
          updatedAt

       }
      }
    }
  }
}
查询{
搜寻(
类型:存储库,
查询:“”
星星:10
尺寸:>2000
推送:>=2019-08-01
创建:>=2018-08-01
""",
最后:100
) {
回购协议:边缘{
回购:节点{
…在存储库上{
名称
描述
网址
所有者{uuuu typename}
licenseInfo{name}
观察者{观察者:totalCount}
释放{releases:totalCount}
叉子:叉子计数
pullRequests{pullRequests:totalCount}
观星者{星星:总数}
openIssues:issues(状态:OPEN){totalCount}
totalIssues:issues{totalIssues:totalCount}
主语言{primaryLanguage:name}
语言(第一:3){nodes{name}}
repositoryTopics(first:3){nodes{topic{name}}}
创建数据
普希达特
更新的
}
}
}
}
}
我想做的是将查询作为.json导入,以便在Python中使用它

我在python中尝试了以下方法,但我正在努力使用json格式

import requests

url = 'https://api.github.com/graphql'
json = {'query': '{stars:<1000} {forks:>10} {size:>2000 {pushed:>=2019-08-01} {created:>=2018-08-01}}'}
api_token = "abc.."
headers = {'Authorization': 'token %s' % api_token}

r = requests.post(url=url, json=json, headers=headers)
print (r.text)
导入请求
url='1〕https://api.github.com/graphql'
json={'query':{stars:10}{size:>2000{push:>=2019-08-01}{created:>=2018-08-01}}
api_token=“abc…”
headers={'Authorization':'token%s'%api\u token}
r=requests.post(url=url,json=json,headers=headers)
打印(右文本)