mirror of
https://github.com/ZuneDev/PyZuneCatalogServer.git
synced 2026-07-27 13:11:13 -07:00
14 lines
283 B
Python
14 lines
283 B
Python
import urllib.request
|
|
import urllib.error
|
|
import json
|
|
from typing import Union
|
|
|
|
|
|
def get_json(url: str) -> Union[int, dict]:
|
|
try:
|
|
response = urllib.request.urlopen(url)
|
|
except urllib.error.HTTPError as error:
|
|
return error.code
|
|
|
|
return json.load(response)
|