22 country = country_info.names.get("en", "N/A")
23 country_code = country_info.iso_code
24 city = reader.city(ip).city.names.get("en", "Unknown City")
25 # print(country, country_code, city)26
27 except AddressNotFoundError as e:
28 print(e)
33 try:
34 with geoip2.database.Reader("resources/databases/GeoLite2-ASN.mmdb") as reader:
35
36 # print(response := reader.asn(ip))37 organization = reader.asn(ip).autonomous_system_organization
38 # print(organization)
39
7
8
9def get_post_data() -> dict:
10 # print(request.content_type)11 data: dict = {}
12 if request.content_type.startswith("application/json"):
13 _data = request.get_data()
13 _data = request.get_data()
14 return json.loads(_data.decode("utf-8"))
15 if request.content_type.startswith("application/x-www-form-urlencoded"):
16 # print(urllib.parse.parse_qs(request.get_data().decode("utf-8")))17 return parse_qs_plus(urllib.parse.parse_qs(request.get_data().decode("utf-8")))
18 for key, value in request.form.items():
19 if key.endswith("[]"):
127 logger.exception("")
128 return False
129
130 # @staticmethod131 # def __linux_check_shadowsocks() -> bool:
132 # sslibev = False
133 # simpleobfs = False
It is recommended to remove any commented code in your codebase.
for item in sequence:
# print(item)
do_something(item)
# def old_function():
# '''Older implementation that has been replaced'''
# data = get_data()
# api.post(data)
for item in sequence:
do_something(item)