0

I am trying to use PyGithub to access GitHub REST API to search repos. Since, API has strict rate limits, I want to filter out as many repos possible during the search.

Before, writing the script in Python, I tried GitHub's web search to get an understanding of the qualifiers.

tensorflow language:Python archived:False -topic:tutorial

The above query finds repos written in Python that has the word "tensorflow" that are not archived and do not contain the topic (it's like a tag for GH repos) tutorial. So GH allows the negative qualifiers by adding a - before the qualifier.

I can't use that when using PyGithub.

gh.search_repositories("tensorflow",
                       language = 'Python',
                       archived = False,
                       -topic = "tutorial",
    )

The last parameter -topic = "tutorial" does not work as identifiers cannot start with - symbol.

Does anyone have any idea how to archive this?

akalanka
  • 553
  • 7
  • 21
  • 1
    Try using `kwargs`? `gh.search_repositories("tensorflow", **{'language': 'Python', 'archived': False, '-topic': 'tutorial'})` – Wondercricket Jun 29 '23 at 16:29
  • Thanks for the suggestion. I took the `**kwargs` too literally. This is a much better option so I could use qualifiers like `is` as a key. So, to respond to your suggestion, it works perfectly. Would you like to compose an answer so I could accept it. – akalanka Jun 29 '23 at 18:45

0 Answers0