1
- # swagger-client
1
+ # leetcode
2
2
Leetcode API implementation.
3
3
4
4
@@ -32,7 +32,6 @@ You can find examples of usage in `example.py`
32
32
33
33
[ 1] https://github.com/skygragon/leetcode-cli
34
34
35
-
36
35
This Python package is automatically generated by the [ Swagger Codegen] ( https://github.com/swagger-api/swagger-codegen ) project:
37
36
38
37
- API version: 1.0.1-1
@@ -55,7 +54,7 @@ pip install git+https://github.com/prius/python-leetcode.git
55
54
56
55
Then import the package:
57
56
``` python
58
- import swagger_client
57
+ import leetcode
59
58
```
60
59
61
60
### Setuptools
@@ -69,7 +68,7 @@ python setup.py install --user
69
68
70
69
Then import the package:
71
70
``` python
72
- import swagger_client
71
+ import leetcode
73
72
```
74
73
75
74
## Getting Started
@@ -79,33 +78,33 @@ Please follow the [installation procedure](#installation--usage) and then run th
79
78
``` python
80
79
from __future__ import print_function
81
80
import time
82
- import swagger_client
83
- from swagger_client .rest import ApiException
81
+ import leetcode
82
+ from leetcode .rest import ApiException
84
83
from pprint import pprint
85
84
86
85
# Configure API key authorization: cookieCSRF
87
- configuration = swagger_client .Configuration()
86
+ configuration = leetcode .Configuration()
88
87
configuration.api_key[' csrftoken' ] = ' YOUR_API_KEY'
89
88
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
90
89
# configuration.api_key_prefix['csrftoken'] = 'Bearer'
91
90
# Configure API key authorization: cookieSession
92
- configuration = swagger_client .Configuration()
91
+ configuration = leetcode .Configuration()
93
92
configuration.api_key[' LEETCODE_SESSION' ] = ' YOUR_API_KEY'
94
93
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
95
94
# configuration.api_key_prefix['LEETCODE_SESSION'] = 'Bearer'
96
95
# Configure API key authorization: headerCSRF
97
- configuration = swagger_client .Configuration()
96
+ configuration = leetcode .Configuration()
98
97
configuration.api_key[' x-csrftoken' ] = ' YOUR_API_KEY'
99
98
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
100
99
# configuration.api_key_prefix['x-csrftoken'] = 'Bearer'
101
100
# Configure API key authorization: referer
102
- configuration = swagger_client .Configuration()
101
+ configuration = leetcode .Configuration()
103
102
configuration.api_key[' Referer' ] = ' YOUR_API_KEY'
104
103
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
105
104
# configuration.api_key_prefix['Referer'] = 'Bearer'
106
105
107
106
# create an instance of the API class
108
- api_instance = swagger_client .DefaultApi(swagger_client .ApiClient(configuration))
107
+ api_instance = leetcode .DefaultApi(leetcode .ApiClient(configuration))
109
108
topic = ' topic_example' # str |
110
109
111
110
try :
@@ -115,29 +114,29 @@ except ApiException as e:
115
114
print (" Exception when calling DefaultApi->api_problems_topic_get: %s \n " % e)
116
115
117
116
# Configure API key authorization: cookieCSRF
118
- configuration = swagger_client .Configuration()
117
+ configuration = leetcode .Configuration()
119
118
configuration.api_key[' csrftoken' ] = ' YOUR_API_KEY'
120
119
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
121
120
# configuration.api_key_prefix['csrftoken'] = 'Bearer'
122
121
# Configure API key authorization: cookieSession
123
- configuration = swagger_client .Configuration()
122
+ configuration = leetcode .Configuration()
124
123
configuration.api_key[' LEETCODE_SESSION' ] = ' YOUR_API_KEY'
125
124
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
126
125
# configuration.api_key_prefix['LEETCODE_SESSION'] = 'Bearer'
127
126
# Configure API key authorization: headerCSRF
128
- configuration = swagger_client .Configuration()
127
+ configuration = leetcode .Configuration()
129
128
configuration.api_key[' x-csrftoken' ] = ' YOUR_API_KEY'
130
129
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
131
130
# configuration.api_key_prefix['x-csrftoken'] = 'Bearer'
132
131
# Configure API key authorization: referer
133
- configuration = swagger_client .Configuration()
132
+ configuration = leetcode .Configuration()
134
133
configuration.api_key[' Referer' ] = ' YOUR_API_KEY'
135
134
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
136
135
# configuration.api_key_prefix['Referer'] = 'Bearer'
137
136
138
137
# create an instance of the API class
139
- api_instance = swagger_client .DefaultApi(swagger_client .ApiClient(configuration))
140
- body = swagger_client .GraphqlQuery() # GraphqlQuery | GraphQL query (optional)
138
+ api_instance = leetcode .DefaultApi(leetcode .ApiClient(configuration))
139
+ body = leetcode .GraphqlQuery() # GraphqlQuery | GraphQL query (optional)
141
140
142
141
try :
143
142
api_response = api_instance.graphql_post(body = body)
@@ -146,30 +145,30 @@ except ApiException as e:
146
145
print (" Exception when calling DefaultApi->graphql_post: %s \n " % e)
147
146
148
147
# Configure API key authorization: cookieCSRF
149
- configuration = swagger_client .Configuration()
148
+ configuration = leetcode .Configuration()
150
149
configuration.api_key[' csrftoken' ] = ' YOUR_API_KEY'
151
150
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
152
151
# configuration.api_key_prefix['csrftoken'] = 'Bearer'
153
152
# Configure API key authorization: cookieSession
154
- configuration = swagger_client .Configuration()
153
+ configuration = leetcode .Configuration()
155
154
configuration.api_key[' LEETCODE_SESSION' ] = ' YOUR_API_KEY'
156
155
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
157
156
# configuration.api_key_prefix['LEETCODE_SESSION'] = 'Bearer'
158
157
# Configure API key authorization: headerCSRF
159
- configuration = swagger_client .Configuration()
158
+ configuration = leetcode .Configuration()
160
159
configuration.api_key[' x-csrftoken' ] = ' YOUR_API_KEY'
161
160
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
162
161
# configuration.api_key_prefix['x-csrftoken'] = 'Bearer'
163
162
# Configure API key authorization: referer
164
- configuration = swagger_client .Configuration()
163
+ configuration = leetcode .Configuration()
165
164
configuration.api_key[' Referer' ] = ' YOUR_API_KEY'
166
165
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
167
166
# configuration.api_key_prefix['Referer'] = 'Bearer'
168
167
169
168
# create an instance of the API class
170
- api_instance = swagger_client .DefaultApi(swagger_client .ApiClient(configuration))
169
+ api_instance = leetcode .DefaultApi(leetcode .ApiClient(configuration))
171
170
problem = ' problem_example' # str |
172
- body = swagger_client .TestSubmission() # TestSubmission | Solution to test (optional)
171
+ body = leetcode .TestSubmission() # TestSubmission | Solution to test (optional)
173
172
174
173
try :
175
174
api_response = api_instance.problems_problem_interpret_solution_post(problem, body = body)
@@ -178,30 +177,30 @@ except ApiException as e:
178
177
print (" Exception when calling DefaultApi->problems_problem_interpret_solution_post: %s \n " % e)
179
178
180
179
# Configure API key authorization: cookieCSRF
181
- configuration = swagger_client .Configuration()
180
+ configuration = leetcode .Configuration()
182
181
configuration.api_key[' csrftoken' ] = ' YOUR_API_KEY'
183
182
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
184
183
# configuration.api_key_prefix['csrftoken'] = 'Bearer'
185
184
# Configure API key authorization: cookieSession
186
- configuration = swagger_client .Configuration()
185
+ configuration = leetcode .Configuration()
187
186
configuration.api_key[' LEETCODE_SESSION' ] = ' YOUR_API_KEY'
188
187
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
189
188
# configuration.api_key_prefix['LEETCODE_SESSION'] = 'Bearer'
190
189
# Configure API key authorization: headerCSRF
191
- configuration = swagger_client .Configuration()
190
+ configuration = leetcode .Configuration()
192
191
configuration.api_key[' x-csrftoken' ] = ' YOUR_API_KEY'
193
192
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
194
193
# configuration.api_key_prefix['x-csrftoken'] = 'Bearer'
195
194
# Configure API key authorization: referer
196
- configuration = swagger_client .Configuration()
195
+ configuration = leetcode .Configuration()
197
196
configuration.api_key[' Referer' ] = ' YOUR_API_KEY'
198
197
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
199
198
# configuration.api_key_prefix['Referer'] = 'Bearer'
200
199
201
200
# create an instance of the API class
202
- api_instance = swagger_client .DefaultApi(swagger_client .ApiClient(configuration))
201
+ api_instance = leetcode .DefaultApi(leetcode .ApiClient(configuration))
203
202
problem = ' problem_example' # str |
204
- body = swagger_client .Submission() # Submission | Solution to test (optional)
203
+ body = leetcode .Submission() # Submission | Solution to test (optional)
205
204
206
205
try :
207
206
api_response = api_instance.problems_problem_submit_post(problem, body = body)
@@ -210,29 +209,29 @@ except ApiException as e:
210
209
print (" Exception when calling DefaultApi->problems_problem_submit_post: %s \n " % e)
211
210
212
211
# Configure API key authorization: cookieCSRF
213
- configuration = swagger_client .Configuration()
212
+ configuration = leetcode .Configuration()
214
213
configuration.api_key[' csrftoken' ] = ' YOUR_API_KEY'
215
214
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
216
215
# configuration.api_key_prefix['csrftoken'] = 'Bearer'
217
216
# Configure API key authorization: cookieSession
218
- configuration = swagger_client .Configuration()
217
+ configuration = leetcode .Configuration()
219
218
configuration.api_key[' LEETCODE_SESSION' ] = ' YOUR_API_KEY'
220
219
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
221
220
# configuration.api_key_prefix['LEETCODE_SESSION'] = 'Bearer'
222
221
# Configure API key authorization: headerCSRF
223
- configuration = swagger_client .Configuration()
222
+ configuration = leetcode .Configuration()
224
223
configuration.api_key[' x-csrftoken' ] = ' YOUR_API_KEY'
225
224
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
226
225
# configuration.api_key_prefix['x-csrftoken'] = 'Bearer'
227
226
# Configure API key authorization: referer
228
- configuration = swagger_client .Configuration()
227
+ configuration = leetcode .Configuration()
229
228
configuration.api_key[' Referer' ] = ' YOUR_API_KEY'
230
229
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
231
230
# configuration.api_key_prefix['Referer'] = 'Bearer'
232
231
233
232
# create an instance of the API class
234
- api_instance = swagger_client .DefaultApi(swagger_client .ApiClient(configuration))
235
- id = swagger_client .Id() # Id | Either submission id (int) or interpretation id (string)
233
+ api_instance = leetcode .DefaultApi(leetcode .ApiClient(configuration))
234
+ id = leetcode .Id() # Id | Either submission id (int) or interpretation id (string)
236
235
237
236
try :
238
237
api_response = api_instance.submissions_detail_id_check_get(id )
0 commit comments