Spaces:
Runtime error
Runtime error
fix api_url construction bug
Browse files
py_code_analyzer/code_imports_analyzer.py
CHANGED
@@ -18,11 +18,12 @@ def construct_fetch_program_text_api_url(api_url):
|
|
18 |
USER = os.environ.get("USER", "")
|
19 |
PERSONAL_ACCESS_TOKEN = os.environ.get("PERSONAL_ACCESS_TOKEN", "")
|
20 |
|
21 |
-
api_urls = api_url.split("://")
|
22 |
if USER and PERSONAL_ACCESS_TOKEN:
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
|
27 |
|
28 |
async def get_program_text(session, python_file):
|
|
|
18 |
USER = os.environ.get("USER", "")
|
19 |
PERSONAL_ACCESS_TOKEN = os.environ.get("PERSONAL_ACCESS_TOKEN", "")
|
20 |
|
|
|
21 |
if USER and PERSONAL_ACCESS_TOKEN:
|
22 |
+
protocol, api_url_components = api_url.split("://")
|
23 |
+
new_api_url_components = f"{USER}:{PERSONAL_ACCESS_TOKEN}@{api_url_components}"
|
24 |
+
return f"{protocol}://{new_api_url_components}"
|
25 |
+
else:
|
26 |
+
return api_url
|
27 |
|
28 |
|
29 |
async def get_program_text(session, python_file):
|