```python
import xml
import urllib
import urllib.parse
import urllib.request
def init_proxy(
proxy_ip: str,
proxy_port: int,
proxy_global: bool = True
):
proxy_url = f"{proxy_ip}:{proxy_port}"
proxy_handler = urllib.request.ProxyHandler(
proxies={
"http": proxy_url,
"https": proxy_url
}
)
opener = urllib.request.build_opener(proxy_handler)
if proxy_global:
urllib.request.install_opener(opener)
def fetch_arxiv_raw(
search_query: str,
start=0,
max_results=10
) -> str:
base = "
http://export.arxiv.org/api/query?"
params = {
"search_query": search_query,
"start": str(start),
"max_results": str(max_results),
}
url = base + urllib.parse.urlencode(params)
req = urllib.request.Request(url, headers={
"User-Agent": "arXiv-Client/1.0 (@
gmail.com)"
})
with urllib.request.urlopen(req, timeout=30) as resp:
status = getattr(resp, "status", None)
body = resp.read()
if status not in (None, 200):
raise RuntimeError(f"HTTP status {status}")
return body.decode("utf-8")
if __name__ == "__main__":
result = fetch_arxiv_raw(
search_query="all:electron",
start=0,
max_results=5
)
print(result)
```
Here is My Code, but API retuen
```json
I try any keywords, and try url to firefox browser