mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-04-29 03:00:45 -04:00
Compare commits
6 Commits
fix-basic-
...
rb/github-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ac8a35811 | ||
|
|
9d3c6d87fb | ||
|
|
4c935a84e7 | ||
|
|
2ad0831560 | ||
|
|
d865f1e4a7 | ||
|
|
a38c45cf75 |
@@ -227,6 +227,7 @@ class RemoteRuntime(Runtime):
|
|||||||
'command': command,
|
'command': command,
|
||||||
'working_dir': '/openhands/code/',
|
'working_dir': '/openhands/code/',
|
||||||
'environment': {'DEBUG': 'true'} if self.config.debug else {},
|
'environment': {'DEBUG': 'true'} if self.config.debug else {},
|
||||||
|
'session_id': self.sid,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start the sandbox using the /start endpoint
|
# Start the sandbox using the /start endpoint
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import httpx
|
from github import Github
|
||||||
|
from github.GithubException import GithubException
|
||||||
from tenacity import retry, stop_after_attempt, wait_exponential
|
from tenacity import retry, stop_after_attempt, wait_exponential
|
||||||
|
|
||||||
from openhands.core.logger import openhands_logger as logger
|
from openhands.core.logger import openhands_logger as logger
|
||||||
from openhands.server.sheets_client import GoogleSheetsClient
|
from openhands.server.sheets_client import GoogleSheetsClient
|
||||||
|
from openhands.utils.async_utils import call_sync_from_async
|
||||||
|
|
||||||
GITHUB_CLIENT_ID = os.getenv('GITHUB_CLIENT_ID', '').strip()
|
GITHUB_CLIENT_ID = os.getenv('GITHUB_CLIENT_ID', '').strip()
|
||||||
GITHUB_CLIENT_SECRET = os.getenv('GITHUB_CLIENT_SECRET', '').strip()
|
GITHUB_CLIENT_SECRET = os.getenv('GITHUB_CLIENT_SECRET', '').strip()
|
||||||
@@ -113,24 +115,13 @@ async def get_github_user(token: str) -> str:
|
|||||||
github handle of the user
|
github handle of the user
|
||||||
"""
|
"""
|
||||||
logger.debug('Fetching GitHub user info from token')
|
logger.debug('Fetching GitHub user info from token')
|
||||||
headers = {
|
try:
|
||||||
'Accept': 'application/vnd.github+json',
|
g = Github(token)
|
||||||
'Authorization': f'Bearer {token}',
|
user = await call_sync_from_async(g.get_user)
|
||||||
}
|
login = user.login
|
||||||
async with httpx.AsyncClient(
|
|
||||||
timeout=httpx.Timeout(connect=5.0, read=5.0, write=5.0, pool=5.0)
|
|
||||||
) as client:
|
|
||||||
try:
|
|
||||||
response = await client.get('https://api.github.com/user', headers=headers)
|
|
||||||
except httpx.RequestError as e:
|
|
||||||
logger.error(f'Error making request to GitHub API: {str(e)}')
|
|
||||||
logger.error(e)
|
|
||||||
raise
|
|
||||||
|
|
||||||
logger.info('Received response from GitHub API')
|
|
||||||
logger.debug(f'Response status code: {response.status_code}')
|
|
||||||
response.raise_for_status()
|
|
||||||
user_data = response.json()
|
|
||||||
login = user_data.get('login')
|
|
||||||
logger.info(f'Successfully retrieved GitHub user: {login}')
|
logger.info(f'Successfully retrieved GitHub user: {login}')
|
||||||
return login
|
return login
|
||||||
|
except GithubException as e:
|
||||||
|
logger.error(f'Error making request to GitHub API: {str(e)}')
|
||||||
|
logger.error(e)
|
||||||
|
raise
|
||||||
|
|||||||
52
poetry.lock
generated
52
poetry.lock
generated
@@ -6778,6 +6778,25 @@ files = [
|
|||||||
{file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"},
|
{file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pygithub"
|
||||||
|
version = "2.5.0"
|
||||||
|
description = "Use the full Github API v3"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.8"
|
||||||
|
files = [
|
||||||
|
{file = "PyGithub-2.5.0-py3-none-any.whl", hash = "sha256:b0b635999a658ab8e08720bdd3318893ff20e2275f6446fcf35bf3f44f2c0fd2"},
|
||||||
|
{file = "pygithub-2.5.0.tar.gz", hash = "sha256:e1613ac508a9be710920d26eb18b1905ebd9926aa49398e88151c1b526aad3cf"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
Deprecated = "*"
|
||||||
|
pyjwt = {version = ">=2.4.0", extras = ["crypto"]}
|
||||||
|
pynacl = ">=1.4.0"
|
||||||
|
requests = ">=2.14.0"
|
||||||
|
typing-extensions = ">=4.0.0"
|
||||||
|
urllib3 = ">=1.26.0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pygments"
|
name = "pygments"
|
||||||
version = "2.18.0"
|
version = "2.18.0"
|
||||||
@@ -6842,6 +6861,32 @@ files = [
|
|||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
pybind11 = ">=2.2"
|
pybind11 = ">=2.2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pynacl"
|
||||||
|
version = "1.5.0"
|
||||||
|
description = "Python binding to the Networking and Cryptography (NaCl) library"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.6"
|
||||||
|
files = [
|
||||||
|
{file = "PyNaCl-1.5.0-cp36-abi3-macosx_10_10_universal2.whl", hash = "sha256:401002a4aaa07c9414132aaed7f6836ff98f59277a234704ff66878c2ee4a0d1"},
|
||||||
|
{file = "PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl", hash = "sha256:52cb72a79269189d4e0dc537556f4740f7f0a9ec41c1322598799b0bdad4ef92"},
|
||||||
|
{file = "PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a36d4a9dda1f19ce6e03c9a784a2921a4b726b02e1c736600ca9c22029474394"},
|
||||||
|
{file = "PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:0c84947a22519e013607c9be43706dd42513f9e6ae5d39d3613ca1e142fba44d"},
|
||||||
|
{file = "PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:06b8f6fa7f5de8d5d2f7573fe8c863c051225a27b61e6860fd047b1775807858"},
|
||||||
|
{file = "PyNaCl-1.5.0-cp36-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:a422368fc821589c228f4c49438a368831cb5bbc0eab5ebe1d7fac9dded6567b"},
|
||||||
|
{file = "PyNaCl-1.5.0-cp36-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:61f642bf2378713e2c2e1de73444a3778e5f0a38be6fee0fe532fe30060282ff"},
|
||||||
|
{file = "PyNaCl-1.5.0-cp36-abi3-win32.whl", hash = "sha256:e46dae94e34b085175f8abb3b0aaa7da40767865ac82c928eeb9e57e1ea8a543"},
|
||||||
|
{file = "PyNaCl-1.5.0-cp36-abi3-win_amd64.whl", hash = "sha256:20f42270d27e1b6a29f54032090b972d97f0a1b0948cc52392041ef7831fee93"},
|
||||||
|
{file = "PyNaCl-1.5.0.tar.gz", hash = "sha256:8ac7448f09ab85811607bdd21ec2464495ac8b7c66d146bf545b0f08fb9220ba"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
cffi = ">=1.4.1"
|
||||||
|
|
||||||
|
[package.extras]
|
||||||
|
docs = ["sphinx (>=1.6.5)", "sphinx-rtd-theme"]
|
||||||
|
tests = ["hypothesis (>=3.27.0)", "pytest (>=3.2.1,!=3.3.0)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyparsing"
|
name = "pyparsing"
|
||||||
version = "3.2.0"
|
version = "3.2.0"
|
||||||
@@ -7995,6 +8040,11 @@ files = [
|
|||||||
{file = "scikit_learn-1.5.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f60021ec1574e56632be2a36b946f8143bf4e5e6af4a06d85281adc22938e0dd"},
|
{file = "scikit_learn-1.5.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f60021ec1574e56632be2a36b946f8143bf4e5e6af4a06d85281adc22938e0dd"},
|
||||||
{file = "scikit_learn-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:394397841449853c2290a32050382edaec3da89e35b3e03d6cc966aebc6a8ae6"},
|
{file = "scikit_learn-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:394397841449853c2290a32050382edaec3da89e35b3e03d6cc966aebc6a8ae6"},
|
||||||
{file = "scikit_learn-1.5.2-cp312-cp312-win_amd64.whl", hash = "sha256:57cc1786cfd6bd118220a92ede80270132aa353647684efa385a74244a41e3b1"},
|
{file = "scikit_learn-1.5.2-cp312-cp312-win_amd64.whl", hash = "sha256:57cc1786cfd6bd118220a92ede80270132aa353647684efa385a74244a41e3b1"},
|
||||||
|
{file = "scikit_learn-1.5.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9a702e2de732bbb20d3bad29ebd77fc05a6b427dc49964300340e4c9328b3f5"},
|
||||||
|
{file = "scikit_learn-1.5.2-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:b0768ad641981f5d3a198430a1d31c3e044ed2e8a6f22166b4d546a5116d7908"},
|
||||||
|
{file = "scikit_learn-1.5.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:178ddd0a5cb0044464fc1bfc4cca5b1833bfc7bb022d70b05db8530da4bb3dd3"},
|
||||||
|
{file = "scikit_learn-1.5.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f7284ade780084d94505632241bf78c44ab3b6f1e8ccab3d2af58e0e950f9c12"},
|
||||||
|
{file = "scikit_learn-1.5.2-cp313-cp313-win_amd64.whl", hash = "sha256:b7b0f9a0b1040830d38c39b91b3a44e1b643f4b36e36567b80b7c6bd2202a27f"},
|
||||||
{file = "scikit_learn-1.5.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:757c7d514ddb00ae249832fe87100d9c73c6ea91423802872d9e74970a0e40b9"},
|
{file = "scikit_learn-1.5.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:757c7d514ddb00ae249832fe87100d9c73c6ea91423802872d9e74970a0e40b9"},
|
||||||
{file = "scikit_learn-1.5.2-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:52788f48b5d8bca5c0736c175fa6bdaab2ef00a8f536cda698db61bd89c551c1"},
|
{file = "scikit_learn-1.5.2-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:52788f48b5d8bca5c0736c175fa6bdaab2ef00a8f536cda698db61bd89c551c1"},
|
||||||
{file = "scikit_learn-1.5.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:643964678f4b5fbdc95cbf8aec638acc7aa70f5f79ee2cdad1eec3df4ba6ead8"},
|
{file = "scikit_learn-1.5.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:643964678f4b5fbdc95cbf8aec638acc7aa70f5f79ee2cdad1eec3df4ba6ead8"},
|
||||||
@@ -10128,4 +10178,4 @@ testing = ["coverage[toml]", "zope.event", "zope.testing"]
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.12"
|
python-versions = "^3.12"
|
||||||
content-hash = "8a34ef6158ca2a9fe3615fc362db3fd71bc43eabb57ffc2e2e14dfb658cf52c3"
|
content-hash = "245fd4cd56a3c95b2dd4f3a06251f7de82ad0300de7349f0710aac1f92a151b7"
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ opentelemetry-api = "1.25.0"
|
|||||||
opentelemetry-exporter-otlp-proto-grpc = "1.25.0"
|
opentelemetry-exporter-otlp-proto-grpc = "1.25.0"
|
||||||
modal = "^0.64.145"
|
modal = "^0.64.145"
|
||||||
runloop-api-client = "0.7.0"
|
runloop-api-client = "0.7.0"
|
||||||
|
pygithub = "^2.5.0"
|
||||||
|
|
||||||
[tool.poetry.group.llama-index.dependencies]
|
[tool.poetry.group.llama-index.dependencies]
|
||||||
llama-index = "*"
|
llama-index = "*"
|
||||||
@@ -93,6 +94,7 @@ reportlab = "*"
|
|||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
concurrency = ["gevent"]
|
concurrency = ["gevent"]
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.group.runtime.dependencies]
|
[tool.poetry.group.runtime.dependencies]
|
||||||
jupyterlab = "*"
|
jupyterlab = "*"
|
||||||
notebook = "*"
|
notebook = "*"
|
||||||
@@ -123,6 +125,7 @@ ignore = ["D1"]
|
|||||||
[tool.ruff.lint.pydocstyle]
|
[tool.ruff.lint.pydocstyle]
|
||||||
convention = "google"
|
convention = "google"
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.group.evaluation.dependencies]
|
[tool.poetry.group.evaluation.dependencies]
|
||||||
streamlit = "*"
|
streamlit = "*"
|
||||||
whatthepatch = "*"
|
whatthepatch = "*"
|
||||||
|
|||||||
Reference in New Issue
Block a user