-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathmain.py
More file actions
35 lines (26 loc) · 1.03 KB
/
main.py
File metadata and controls
35 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
Example script demonstrating how to use both square and square_legacy packages together.
"""
from square_legacy.client import Client as LegacySquare # type: ignore
from square import Square
def main():
print("Using both square and square_legacy packages together")
# Initialize clients from both packages
client = Square(token="<YOUR_API_KEY>")
legacy_client = LegacySquare(access_token="<YOUR_API_KEY>")
# Use functionality from new client
print("\nUsing new square client:")
try:
response = client.payments.list()
print(f"New client payment results: {response.items}")
except Exception as e:
print(f"Example new client call failed: {e}")
# Use functionality from legacy client
print("\nUsing legacy square client:")
try:
legacy_response = legacy_client.payments.list_payments()
print(f"Legacy client payment results: {legacy_response}")
except Exception as e:
print(f"Example legacy client call failed: {e}")
if __name__ == "__main__":
main()