python-amcards 1.3.4__tar.gz → 1.3.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-amcards
3
- Version: 1.3.4
3
+ Version: 1.3.6
4
4
  Summary: A wrapper for the AMcards API.
5
5
  Home-page: https://github.com/simonesestili/python-amcards
6
6
  Author: Simone Sestili
@@ -1,6 +1,6 @@
1
1
  import time
2
2
  from typing import Optional
3
- from datetime import datetime
3
+ import datetime
4
4
 
5
5
  REQUIRED_SHIPPING_ADDRESS_FIELDS = {
6
6
  'first_name',
@@ -42,28 +42,28 @@ def current_timestamp() -> int:
42
42
  return int(time.time() * 1000)
43
43
 
44
44
  def today() -> str:
45
- today = datetime.today()
45
+ today = datetime.datetime.today()
46
46
  yyyy = today.year
47
47
  mm, dd = map(lambda x: str(x).zfill(2), (today.month, today.day))
48
48
  return f'{yyyy}-{mm}-{dd}'
49
49
 
50
- def to_datetime(datetime_str: Optional[str]) -> Optional[datetime]:
50
+ def to_datetime(datetime_str: Optional[str]) -> Optional[datetime.datetime]:
51
51
  if datetime_str is None:
52
52
  return None
53
53
 
54
54
  if 'T' in datetime_str:
55
55
  if '.' in datetime_str:
56
- return datetime.strptime(datetime_str, '%Y-%m-%dT%H:%M:%S.%f')
57
- return datetime.strptime(datetime_str, '%Y-%m-%dT%H:%M:%S')
56
+ return datetime.datetime.strptime(datetime_str, '%Y-%m-%dT%H:%M:%S.%f')
57
+ return datetime.datetime.strptime(datetime_str, '%Y-%m-%dT%H:%M:%S')
58
58
 
59
59
  if ' ' in datetime_str:
60
60
  if '.' in datetime_str:
61
- return datetime.strptime(datetime_str, '%Y-%m-%d %H:%M:%S.%f')
62
- return datetime.strptime(datetime_str, '%Y-%m-%d %H:%M:%S')
61
+ return datetime.datetime.strptime(datetime_str, '%Y-%m-%d %H:%M:%S.%f')
62
+ return datetime.datetime.strptime(datetime_str, '%Y-%m-%d %H:%M:%S')
63
63
 
64
64
  if '.' in datetime_str:
65
- return datetime.strptime(datetime_str, '%Y-%m-%d%H:%M:%S.%f')
66
- return datetime.strptime(datetime_str, '%Y-%m-%d%H:%M:%S')
65
+ return datetime.datetime.strptime(datetime_str, '%Y-%m-%d%H:%M:%S.%f')
66
+ return datetime.datetime.strptime(datetime_str, '%Y-%m-%d%H:%M:%S')
67
67
 
68
68
  def format_cents(price_in_cents: int) -> str:
69
69
  whole, fractional = map(str, divmod(price_in_cents, 100))
@@ -1011,11 +1011,11 @@ class AMcardsClient:
1011
1011
 
1012
1012
  # Validate birth_date
1013
1013
  if 'birth_date' in shipping_address and not helpers.is_valid_birthdate(shipping_address['birth_date']):
1014
- error_message = 'Invalid birth_date format, please specify date as "YYYY-MM-DD", or omit it'
1014
+ error_message = f'Invalid birth_date format of "{shipping_address["birth_date"]}", please specify date as "YYYY-MM-DD", or omit it'
1015
1015
  raise exceptions.DateFormatError(error_message)
1016
1016
  # Validate anniversary_date
1017
1017
  if 'anniversary_date' in shipping_address and not helpers.is_valid_date(shipping_address['anniversary_date']):
1018
- error_message = 'Invalid anniversary_date format, please specify date as "YYYY-MM-DD", or omit it'
1018
+ error_message = f'Invalid anniversary_date format of "{shipping_address["anniversary_date"]}", please specify date as "YYYY-MM-DD", or omit it'
1019
1019
  raise exceptions.DateFormatError(error_message)
1020
1020
  # Validate phone_number
1021
1021
  if 'phone_number' in shipping_address and not helpers.is_valid_phone(shipping_address['phone_number']):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-amcards
3
- Version: 1.3.4
3
+ Version: 1.3.6
4
4
  Summary: A wrapper for the AMcards API.
5
5
  Home-page: https://github.com/simonesestili/python-amcards
6
6
  Author: Simone Sestili
@@ -7,7 +7,7 @@ def README():
7
7
 
8
8
  setup(
9
9
  name='python-amcards',
10
- version='1.3.4',
10
+ version='1.3.6',
11
11
  description='A wrapper for the AMcards API.',
12
12
  long_description=README(),
13
13
  long_description_content_type='text/x-rst',
File without changes
File without changes