Skip to main content

Github-search-cli

Project description

Github-search-cli

python3 project-url version Contributors Forks Stargazers Issues

GitHub restful API search implementation on python3

About

github-search-cli provides a module called Github, that can be used to access all of GitHub's Search API functionality from your command-line

https://docs.github.com/en/rest/search

Installation

Installing gitub-search-cli using pip

pip3 install github-search-cli

OR

Installing through GitHub

pip3 install --upgrade git+https://github.com/SonyaCore/Github-search-cli.git

Usage

Show help and exit

python3 -m Github -h

Options

  --query , -q     Query for the searching method
  --sort , -s      Sorting method for request output
  --order , -o     Define the first search result returned is the highest or lowest number of matches.
  --perpage , -p   The number of results per page
  --page , -page   Page number of the results to fetch.
  --repoid , -i    Repository id for labels endpoint
  --save , -j      Save JSON output

all the search queries for https://docs.github.com/en/rest/search is implemented on this python module

list of available search queries code,commits,issues,labels,repository,topics,users

for fetching 100 results or 200 results per page use --perpage arugment ex :

python3 -m Github repository --query repo:username/repo --perpage 200 --save reg.json

Search examples

Search for users with a query

python3 -m Github users -q user  --save user.json

Search for repositories with defined arguments

python3 -m Github repository --query repo:username/repo --save reg.json

Using API

You can also use it like this:

from Github.Search import Search
from Github.Timer import Timer


# initial github class
github = Search()

# initial timer class
timer = Timer()

# intial a timer (optional)
timer.start()

# using github.user method to fetch users from GitHub rest API with a query
users = github.users("code")

# using github.repository method to fetch repositories based on their name and ...
repository = github.repository("test",sort="stars",order="desc")


# using github.commits method to search on commits
commits = github.commits("repo:octocat/Spoon-Knife+css",sort="committer-date")

# printing the fetched data
print(users)
print(repository)
print(commits)

# save the result to a JSON file
github.save("user.json", users)
github.save("repo.json",repository)
github.save("commits.json",commits)

timer.stop()

License

Licensed under the GPL-3 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

github-search-cli-0.4.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

github_search_cli-0.4-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file github-search-cli-0.4.tar.gz.

File metadata

  • Download URL: github-search-cli-0.4.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for github-search-cli-0.4.tar.gz
Algorithm Hash digest
SHA256 0927c76ded3c3ef8a8106c3dc3a8b173ef74706060857a36f5dd08581206e479
MD5 2bb60e25501e17408848367f21d1c7cd
BLAKE2b-256 6de147dc1095164c64fc947d2a37ad436be43d6f951a039e2b7ef99c47ae69a0

See more details on using hashes here.

File details

Details for the file github_search_cli-0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for github_search_cli-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 eb3dfd91c04f9ee6b3eeb42724652183380737d10a5666fbb3ac2018ef7e8d49
MD5 34218c3e21bf4312d4b8314668c26ae1
BLAKE2b-256 9507269017b69315525a5da6e5d2f6bb3247fe816baf338654d31afa784c96b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page