Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
The best way to interact with GitHub API.
Note: This module is useful for the GitHub API
Your URL should look like this https://api.github.com This is working module with your PAT Token
from github_module import GitHubHelper
To initialize a connection to GitHub, instantiate the GitHubHelper
class with your GitHub URL, ORG, and Personal API Token:
github_helper = GitHubHelper(GITHUB_API, API_TOKEN)
int
: The remaining rate limit.-1
: If there was an error retrieving the rate limit.remaining_requests = github_helper.get_rate_limit()
print(f"Remaining rate limit: {remaining_requests}")
owner
(str): The username or organization that owns the repository.repo
(str): The name of the repository.dict
:
"status"
(str): Indicates the result of the check. Possible values are "exists", "not_found", "forbidden", "rate_limit_exceeded", and "error"."message"
(str): A message providing details about the result.result = github_helper.check_repository(owner="octocat", repo="Hello-World")
print(result["status"]) # e.g., "exists"
print(result["message"]) # e.g., "Repository exists."
owner
(str): The username or organization that owns the repository.repo
(str): The name of the repository.True
: If the repository is read-only.False
: If the repository is writable.None
: If there was an error checking the repository (e.g., rate limit too low, repository not found).PAT
(str): The PAT token to check expiry.int
: The remaining number of days.-1
: If there is no expiry of the PAT token.-2
: If there was an error retrieving the number of days.expiry_days = github_helper.get_token_expiry_days()
print(expiry_days)
if expiry_days >= 0:
print(f"Token expires in {expiry_days} days.")
elif expiry_days == -1:
print("Token has no expiration (infinite).")
else:
print("An error occurred while checking the token expiration.")
🔒 We respect your privacy: This module does not store any of your data anywhere. It simply interacts with the GitHub API to perform the requested operations. Ensure you manage your connection details securely.
get_token_expiry_days
use case code in README.mdget_token_expiry_days
function to determine the number of days remaining on the PAT token. Occasionally, our automation fails due to the use of PATs with limited expiry. To prevent this, we’ve added a check to ensure the token’s validity.is_repo_read_only
function to determine whether a repository is read-only, helping users avoid unauthorized write operations.check_repository
function to verify if a GitHub repository exists and handle various error scenarios such as permissions issues and rate limit exhaustion.get_rate_limit
function to fetch the current rate limit from the GitHub API, ensuring users can manage their API request limits effectively.FAQs
Modules for interacting with GitHub API.
We found that github-module demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.