Skip to content

Use dateutil for parsing datetime strings #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 3, 2025

Conversation

execreate
Copy link

Hey there, thanks a lot for the nice tool! I've noticed there is a minor thing with datetime parsing that can be improved. The current implementation throws the following error:

Traceback (most recent call last):
  File "/myproject/venv/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3550, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-5-0cf0aa12b443>", line 1, in <module>
    twin = manager.get_twin("my_device")
  File "/myproject/venv/lib/python3.10/site-packages/azure_iot_hub_api/azure_iot_hub.py", line 34, in get_twin
    return Twin.from_dictionary(result)
  File "/myproject/venv/lib/python3.10/site-packages/azure_iot_hub_api/models.py", line 167, in from_dictionary
    status_update_time = datetime.fromisoformat(twin_dictionary.get("statusUpdateTime"))
ValueError: Invalid isoformat string: '2025-01-27T16:35:04.6698773Z'

This pull request should fix this.

@birddevelper birddevelper self-requested a review April 3, 2025 09:50
@birddevelper birddevelper merged commit f442952 into birddevelper:main Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants