Skip to content

Commit fe8f966

Browse files
authored
Api V2 (#25)
* Update docs Get schedules working Update example Update to allow ToO deletes Check minimal server version Add image download Cleanup * Add targname * Finalise new syntax * Finish API upgrading * Update tests * Update tests
1 parent 27ae189 commit fe8f966

20 files changed

+4790
-1019
lines changed

notebooks/1_too_models.ipynb

Lines changed: 0 additions & 663 deletions
This file was deleted.
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "3fb54b95",
7+
"metadata": {
8+
"scrolled": true
9+
},
10+
"outputs": [],
11+
"source": [
12+
"import logging\n",
13+
"from winterapi import WinterAPI\n",
14+
"from winterapi.endpoints import BASE_URL"
15+
]
16+
},
17+
{
18+
"cell_type": "code",
19+
"execution_count": 2,
20+
"id": "84869822",
21+
"metadata": {},
22+
"outputs": [],
23+
"source": [
24+
"logging.getLogger(\"winterapi\").setLevel(\"DEBUG\")"
25+
]
26+
},
27+
{
28+
"cell_type": "code",
29+
"execution_count": 3,
30+
"id": "b7024bc4",
31+
"metadata": {},
32+
"outputs": [],
33+
"source": [
34+
"winter = WinterAPI()"
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": 4,
40+
"id": "25197a54",
41+
"metadata": {
42+
"scrolled": true
43+
},
44+
"outputs": [
45+
{
46+
"name": "stdout",
47+
"output_type": "stream",
48+
"text": [
49+
"Using server http://winter.caltech.edu:82\n",
50+
"Pinging server: True\n"
51+
]
52+
}
53+
],
54+
"source": [
55+
"print(f\"Using server {BASE_URL}\") # Should show the URL of the API\n",
56+
"print(f\"Pinging server: {winter.ping()}\")"
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": 5,
62+
"id": "88d1d907",
63+
"metadata": {},
64+
"outputs": [
65+
{
66+
"name": "stdout",
67+
"output_type": "stream",
68+
"text": [
69+
"User is rdstein@caltech.edu\n"
70+
]
71+
}
72+
],
73+
"source": [
74+
"try:\n",
75+
" print(f\"User is {winter.get_user()}\")\n",
76+
"except KeyError:\n",
77+
" print(\"No user credentials found. Please add these first!\")\n",
78+
" winter.add_user_details(overwrite=True)"
79+
]
80+
},
81+
{
82+
"cell_type": "code",
83+
"execution_count": 6,
84+
"id": "f0dc0b3f",
85+
"metadata": {},
86+
"outputs": [],
87+
"source": [
88+
"# Uncomment to add new credentials\n",
89+
"# winter.add_user_details(user=x, password=y, overwrite=True)"
90+
]
91+
},
92+
{
93+
"cell_type": "code",
94+
"execution_count": 7,
95+
"id": "64797375",
96+
"metadata": {},
97+
"outputs": [
98+
{
99+
"name": "stdout",
100+
"output_type": "stream",
101+
"text": [
102+
"Found the following saved programs: ['2024A001']\n"
103+
]
104+
}
105+
],
106+
"source": [
107+
"print(f\"Found the following saved programs: {winter.get_programs()}\")\n",
108+
"if len(winter.get_programs()) == 0:\n",
109+
" print(\"No programs found. Add one to get started:\")\n",
110+
" winter.add_program(overwrite=True)"
111+
]
112+
},
113+
{
114+
"cell_type": "code",
115+
"execution_count": null,
116+
"id": "42f4d81b",
117+
"metadata": {},
118+
"outputs": [],
119+
"source": [
120+
"# Uncomment to add additional programs\n",
121+
"winter.add_program(overwrite=True)"
122+
]
123+
},
124+
{
125+
"cell_type": "code",
126+
"execution_count": null,
127+
"id": "b16a0900",
128+
"metadata": {},
129+
"outputs": [],
130+
"source": [
131+
"# A fake local program I have created\n",
132+
"winter.get_program_details(\"202XA000\")"
133+
]
134+
},
135+
{
136+
"cell_type": "code",
137+
"execution_count": null,
138+
"id": "1023561f",
139+
"metadata": {},
140+
"outputs": [],
141+
"source": []
142+
}
143+
],
144+
"metadata": {
145+
"kernelspec": {
146+
"display_name": "winterapi",
147+
"language": "python",
148+
"name": "winterapi"
149+
},
150+
"language_info": {
151+
"codemirror_mode": {
152+
"name": "ipython",
153+
"version": 3
154+
},
155+
"file_extension": ".py",
156+
"mimetype": "text/x-python",
157+
"name": "python",
158+
"nbconvert_exporter": "python",
159+
"pygments_lexer": "ipython3",
160+
"version": "3.11.3"
161+
}
162+
},
163+
"nbformat": 4,
164+
"nbformat_minor": 5
165+
}

0 commit comments

Comments
 (0)