- 
                Notifications
    You must be signed in to change notification settings 
- Fork 707
Open
Description
When getting "commits" from bitbucket cloud the date attribute is returning an exception.
        for commit in commits:
            print(commit)
            
            try:
                print(commit.date)
            except Exception as e:
                print(f"Error: {e}")
Output
...
'date': '2025-09-18T21:26:38+00:00',
...
Error: time data '2025-09-18T21:26:38+00:00Z' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'
I can get it to work if I update the BitbucketBase.get_time() method
Current
            if sys.version_info <= (3, 7):
                value_str = RE_TIMEZONE.sub(r"\1\2", value_str)
            try:
                value_str = value_str[:26] + "Z"
                value = datetime.strptime(value_str, self.CONF_TIMEFORMAT)
            except ValueError:
                value = datetime.strptime(
                    value_str,
                    "%Y-%m-%dT%H:%M:%S.%fZ",
                )
Working code
            if sys.version_info <= (3, 7):
                value_str = RE_TIMEZONE.sub(r"\1\2", value_str)
            try:
                
                value = datetime.strptime(value_str[:26] + "Z", self.CONF_TIMEFORMAT)
            except ValueError:
                value = datetime.strptime(
                    value_str,
                    "%Y-%m-%dT%H:%M:%S%f%z",
                )
Other info
python --version
Python 3.11.13
pip list
Package              Version     Editable project location
-------------------- ----------- ----------------------------
atlassian-python-api 4.0.7
bb-data              0.1.0       /home/marty/projects/bb-data
beautifulsoup4       4.13.5
certifi              2025.8.3
charset-normalizer   3.4.3
Deprecated           1.2.18
idna                 3.10
jmespath             1.0.1
numpy                2.3.3
oauthlib             3.3.1
pandas               2.3.2
pip                  24.0
python-dateutil      2.9.0.post0
python-dotenv        1.1.1
pytz                 2025.2
requests             2.32.5
requests-oauthlib    2.0.0
setuptools           68.1.2
six                  1.17.0
soupsieve            2.8
typing_extensions    4.15.0
tzdata               2025.2
urllib3              2.5.0
wheel                0.42.0
wrapt                1.17.3
Metadata
Metadata
Assignees
Labels
No labels