Update api_like_OAI.py

In most offices proxy settings make it impossible to use either internet or accessing a server on network, I made this change to achieve them both.
This commit is contained in:
superchargez 2023-08-30 11:22:53 +05:00 committed by GitHub
parent 06abf8eeba
commit 63df86754d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,18 @@
#!/usr/bin/env python3
import os
import requests
# Save original proxy settings
original_http_proxy = os.environ.get('http_proxy')
original_https_proxy = os.environ.get('https_proxy')
# Unset the proxies
os.environ['http_proxy'] = ''
os.environ['https_proxy'] = ''
# Reset the proxies to original values after your code
if original_http_proxy is not None:
os.environ['http_proxy'] = original_http_proxy
if original_https_proxy is not None:
os.environ['https_proxy'] = original_https_proxy
import argparse
from flask import Flask, jsonify, request, Response
import urllib.parse