Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
adhami3310 committed Jul 24, 2024
1 parent ed66a3b commit 3d93c4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion reflex/utils/china.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
"""This module contains utility functions for checking if the current IP address is in China."""

from typing import Union

import requests


def _is_in_china():
def _is_in_china() -> Union[bool, None]:
"""Check if the current IP address is in China.
Returns:
bool: True if the IP address is in China, False otherwise.
None: If an error occurred.
"""
try:
response = requests.get(f"http://ip-api.com/json")
data = response.json()
Expand Down
2 changes: 1 addition & 1 deletion reflex/utils/prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from typing import Callable, List, Optional

import httpx
from reflex.utils.china import _is_in_china
import typer
from alembic.util.exc import CommandError
from packaging import version
Expand All @@ -38,6 +37,7 @@
from reflex.compiler import templates
from reflex.config import Config, get_config
from reflex.utils import console, path_ops, processes
from reflex.utils.china import _is_in_china
from reflex.utils.format import format_library_name

CURRENTLY_INSTALLING_NODE = False
Expand Down

0 comments on commit 3d93c4c

Please sign in to comment.