Skip to content

Commit

Permalink
Move to timezonefinder
Browse files Browse the repository at this point in the history
  • Loading branch information
oscgonfer committed Dec 21, 2022
1 parent 3b8c01f commit 3a66949
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setup(
name="smartcitizen-connector",
version="0.1.2",
version="0.2.0",
description="Python connector to download information collected in SmartCitizen API",
author="Óscar González",
license="GNU General Public License v3",
Expand All @@ -30,7 +30,7 @@
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
python_requires=">=3.6",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Development Status :: 3 - Alpha",
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
Expand All @@ -40,8 +40,9 @@
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Utilities",
"Natural Language :: English",
],
install_requires=["pydantic", "requests", "pandas", "tzwhere", "urllib3"],
install_requires=["pydantic", "requests", "pandas", "timezonefinder", "urllib3"],
)
6 changes: 3 additions & 3 deletions src/smartcitizen_connector/smartcitizen_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from requests import get
import urllib3
from pandas import DataFrame, to_datetime
from tzwhere import tzwhere
from timezonefinder import TimezoneFinder
from datetime import datetime

tz_where = tzwhere.tzwhere(forceTZ=True)
tf = TimezoneFinder()

urllib3.disable_warnings()

Expand Down Expand Up @@ -472,7 +472,7 @@ def get_device_timezone(self, update: Optional[bool] = None) -> str:
# Localize it

if latitude is not None and longitude is not None:
self.timezone = tz_where.tzNameAt(latitude, longitude, forceTZ=True)
self.timezone = tf.timezone_at(lng=longitude, lat=latitude)

std_out ('Device {} timezone is {}'.format(self.id, self.timezone))

Expand Down

0 comments on commit 3a66949

Please sign in to comment.