Skip to content

Commit ada1195

Browse files
committed
Add legacy SDK compatibility example
1 parent 7ffdc7c commit ada1195

File tree

4 files changed

+784
-0
lines changed

4 files changed

+784
-0
lines changed

examples/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Square legacy compatiblity
2+
3+
While the new SDK has a lot of improvements, we at Square understand that
4+
it takes time to upgrade when there are breaking changes. To make the
5+
migration easier, the new SDK can be used alongisde legacy SDK, which is
6+
now published as `squareup_legacy`.
7+
8+
This example demonstrates how you can use the legacy SDK alongside the new
9+
SDK inside a single file.
10+
11+
```python
12+
from square import Square
13+
from square_legacy.client import Client as LegacySquare
14+
15+
16+
def main():
17+
client = Square(token="<YOUR_API_KEY>")
18+
legacy_client = LegacySquare(access_token="<YOUR_API_KEY>")
19+
20+
...
21+
```
22+
23+
You can run the example with the following:
24+
25+
```sh
26+
cd example
27+
poetry install
28+
poetry run run-example
29+
```

0 commit comments

Comments
 (0)