You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58-31Lines changed: 58 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,55 @@ You can find specific documentation on a per-product basis below.
35
35
## SDK Documentation
36
36
You can learn more about the Transpose SDK and how it works below.
37
37
38
+
39
+
### SDK Classes
40
+
The Transpose SDK uses custom classes to represent API responses:
41
+
42
+
#### Error Classes
43
+
<details>
44
+
<summary>SDK Error Class Specifications</summary>
45
+
The SDK uses the following error classes to represent API errors:
46
+
47
+
-``TransposeBadRequest``
48
+
- Represents a 400 Bad Request error from the Transpose API.
49
+
-``TransposeRateLimit``
50
+
- Represents a 429 Rate Limit error from the Transpose API.
51
+
-``TransposeInvalidAPIKey``
52
+
- Represents a 401 Unauthorized error from the Transpose API.
53
+
-``TransposeInternalServerError``
54
+
- Represents a 500 Internal Server Error error from the Transpose API.
55
+
-``TransposeResourceNotFound``
56
+
- Represents a 404 Not Found error from the Transpose API.
57
+
58
+
These errors will be raised when the SDK encounters an error from the Transpose API.
59
+
</details>
60
+
61
+
#### Response Classes (**DEPRECATED AS OF v3.1.0**)
62
+
<details>
63
+
<summary>Response Class Specifications</summary>
64
+
65
+
The SDK will always return a list of response objects from the Transpose API. For example, calling the ``ens.records_by_date`` endpoint will return a list of ``ENSRecord`` objects.
66
+
67
+
These response objects can be accessed in the following ways:
68
+
-``ENSRecord[0].ens_name`` will return the first record's ens_name.
69
+
-``ENSRecord[i].ens_name`` retrieves the ens_name from the i-th response
70
+
71
+
All response objects can also be accessed as a dictionary by calling ``.to_dict()`` on them:
72
+
-``ENSRecord[0].to_dict()`` will return the first record as a dictionary.
73
+
-``ENSRecord[i].to_dict()`` retrieves the i-th record as a dictionary.
74
+
</details>
75
+
76
+
---
77
+
78
+
## SDK Options
79
+
The Transpose SDK can be configured to your liking, allowing you to change the default behavior of the SDK.
80
+
38
81
### Updating Chain ID
82
+
<details>
83
+
<summary>
84
+
Updating SDK Working Chain ID
85
+
</summary>
86
+
39
87
If you want to change the chain ID of your query, you can do so by setting the `chain_id` or `chain` properties of the `Transpose` object. For example, if you want to query the Ethereum mainnet, you can do so by running the following code:
40
88
41
89
```python
@@ -66,42 +114,21 @@ api.set_chain(1)
66
114
| :------: | :--------: |
67
115
| 1 | Ethereum |
68
116
| 137 | Polygon |
69
-
70
-
### SDK Classes
71
-
The Transpose SDK uses custom classes to represent API responses:
72
-
73
-
#### Error Classes
74
-
<details>
75
-
<summary>SDK Error Class Specifications</summary>
76
-
The SDK uses the following error classes to represent API errors:
77
-
78
-
-``TransposeBadRequest``
79
-
- Represents a 400 Bad Request error from the Transpose API.
80
-
-``TransposeRateLimit``
81
-
- Represents a 429 Rate Limit error from the Transpose API.
82
-
-``TransposeInvalidAPIKey``
83
-
- Represents a 401 Unauthorized error from the Transpose API.
84
-
-``TransposeInternalServerError``
85
-
- Represents a 500 Internal Server Error error from the Transpose API.
86
-
-``TransposeResourceNotFound``
87
-
- Represents a 404 Not Found error from the Transpose API.
88
-
89
-
These errors will be raised when the SDK encounters an error from the Transpose API.
90
117
</details>
91
118
92
-
#### Response Classes
119
+
###Raw JSON Responses
93
120
<details>
94
-
<summary>Response Class Specifications</summary>
121
+
<summary>
122
+
Opt-in to raw JSON Responses
123
+
</summary>
124
+
If you wish to recieve responses in JSON format, you can set the `json` parameter to `True` when initializing the SDK. This will return all responses as JSON objects.
95
125
96
-
The SDK will always return a list of response objects from the Transpose API. For example, calling the ``ens.records_by_date`` endpoint will return a list of ``ENSRecord`` objects.
126
+
**Response classes are considered deprecated as of v3.1.0 and will be removed in v4.0.0. JSON responses will become standard in v4.0.0**
97
127
98
-
These response objects can be accessed in the following ways:
99
-
-``ENSRecord[0].ens_name`` will return the first record's ens_name.
100
-
-``ENSRecord[i].ens_name`` retrieves the ens_name from the i-th response
101
-
102
-
All response objects can also be accessed as a dictionary by calling ``.to_dict()`` on them:
103
-
-``ENSRecord[0].to_dict()`` will return the first record as a dictionary.
104
-
-``ENSRecord[i].to_dict()`` retrieves the i-th record as a dictionary.
128
+
```python
129
+
from transpose_sdk import Transpose
130
+
api = Transpose(api_key="YOUR_API_KEY", json=True)
0 commit comments