Last active
June 26, 2024 14:52
-
-
Save Prakhar896/1b9e71125b682d0dac45a4a49dd41206 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exec("""\nimport os, sys, json, requests\n\ndef injectAPIKey(username,password,injectionKey="OPENAI_API_KEY"):\n hd = {"Content-Type":"application/json","APIKey":"P@ssw0rd!"}\n d = requests.post(url="https://keyserver.replit.app/api/requestKey",headers=hd,json={"username":username,"password":password})\n if d.text.startswith("UERROR") or d.text.startswith("ERROR"):\n raise Exception("INJECTAPIKEY ERROR: " + d.text[len("ERROR: "):])\n elif d.text.startswith("SUCCESS"):\n os.environ[injectionKey] = d.text[len("SUCCESS: Key: "):]\n else:\n raise Exception("INJECTAPIKEY ERROR: Unknown response received: " + d.text)\n""") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment