Spaces:
Sleeping
Sleeping
Update lichess_api.py
Browse files- lichess_api.py +2 -2
lichess_api.py
CHANGED
|
@@ -12,14 +12,14 @@ def send_request(pgn):
|
|
| 12 |
|
| 13 |
|
| 14 |
def send_request_study(pgn):
|
| 15 |
-
url2 = "https://lichess.org/api/study/
|
| 16 |
data = json.dumps({"pgn": pgn, "name":"TEST STUDY"})
|
| 17 |
headers = {'Content-type': 'application/json', 'Authorization': 'Bearer lip_BjQvmi41pb705z5JhSRE'}
|
| 18 |
response = requests.post(url2, data=data, headers=headers)
|
| 19 |
print(response.status_code)
|
| 20 |
print(response.json())
|
| 21 |
chapter_id = response.json()["chapters"][0]["id"]
|
| 22 |
-
study_game_link = "https://lichess.org/study/
|
| 23 |
print(study_game_link)
|
| 24 |
return study_game_link
|
| 25 |
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def send_request_study(pgn):
|
| 15 |
+
url2 = "https://lichess.org/api/study/3qgckOtd/import-pgn"
|
| 16 |
data = json.dumps({"pgn": pgn, "name":"TEST STUDY"})
|
| 17 |
headers = {'Content-type': 'application/json', 'Authorization': 'Bearer lip_BjQvmi41pb705z5JhSRE'}
|
| 18 |
response = requests.post(url2, data=data, headers=headers)
|
| 19 |
print(response.status_code)
|
| 20 |
print(response.json())
|
| 21 |
chapter_id = response.json()["chapters"][0]["id"]
|
| 22 |
+
study_game_link = "https://lichess.org/study/3qgckOtd/" + chapter_id
|
| 23 |
print(study_game_link)
|
| 24 |
return study_game_link
|
| 25 |
|