mirror of
https://gitea.com/PublicAffairs/openai-github-copilot.git
synced 2025-07-23 20:30:45 +02:00
Scripts: option to specify client_id value
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import http.client
|
||||
import json
|
||||
import sys
|
||||
import time
|
||||
|
||||
TIMEOUT = 10
|
||||
CLIENT_ID = "Iv1.b507a08c87ecfe98" # GitHub Copilot Plugin by GitHub
|
||||
DEFAULT_CLIENT_ID = "Iv1.b507a08c87ecfe98" # GitHub Copilot Plugin by GitHub
|
||||
|
||||
|
||||
def get_token():
|
||||
def get_token(client_id=DEFAULT_CLIENT_ID):
|
||||
# get login info
|
||||
conn = http.client.HTTPSConnection("github.com", timeout=TIMEOUT)
|
||||
headers = {
|
||||
@@ -14,7 +15,7 @@ def get_token():
|
||||
"content-type": "application/json"
|
||||
}
|
||||
body = {
|
||||
"client_id": CLIENT_ID,
|
||||
"client_id": client_id,
|
||||
"scope": "read:user"
|
||||
}
|
||||
conn.request("POST", "/login/device/code", json.dumps(body), headers)
|
||||
@@ -26,7 +27,7 @@ def get_token():
|
||||
print(f"Please open {login_info['verification_uri']} in browser and enter {login_info['user_code']} to login.")
|
||||
|
||||
body = {
|
||||
"client_id": CLIENT_ID,
|
||||
"client_id": client_id,
|
||||
"device_code": login_info['device_code'],
|
||||
"grant_type": "urn:ietf:params:oauth:grant-type:device_code"
|
||||
}
|
||||
|
Reference in New Issue
Block a user