Welcome to the API-First training!
connexion
framework,
mocking our API model, returning Problem objects$ref
to enforce API behaviorBonus tracks:
We will adopt an iterative strategy, progressively:
is the course environment in your browser.
It's not a way for not doing your homework ;)
You can:
ALT+ENTER
FIXME: Go to the basic python course
8888/notebooks
this Jupyter notebook8080
the API Documentation Web UI (Swagger UI)5000
the flask application we will execute during the courseOnce you open the terminal you will find
all the course under /code
.
/code/
│
└── notebooks # All notebooks!
├── oas3 # OpenAPI specifications, files and exercises
│
└── startup # startup files for jupyter, don't touch ;)
To simplify things, during the training we'll run the connexion-flask app with the connexion run
command.
You can always provide a custom __main__.py
like you normally do with your flask app (eg: enable TLS, ...).
Whenever you complete an exercise, you should run
connexion run /code/notebooks/oas3/openapi.yaml
During the course we'll write two files:
You can find solutions in the training directory, so if you can't complete your openapi.yaml
you can run the solution (which ends with -ok.yaml
instead, with
connexion run /code/notebooks/oas3/ex-03-02-path-ok.yaml
In [ ]:
# An API Editor is available at the following address
print(oas_editor_url(''))
In [ ]:
# You can evaluate maths and strings
s = 1
print("a string and the number " + str(s))
s = s + 1
print("now s is increased " + str(s))
In [ ]:
# Note: all notebooks preload the definitions in
!ls -l /root/.ipython/profile_default/startup
Create a docker-18-04 droplet and ssh
into it.
# vim /etc/systemd/system/multi-user.target.wants/docker.service
[Service]
...
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://172.17.0.1:2375
...
#wq!
systemctl daemon-reload
systemctl restart docker
git clone https://github.com/ioggstream/python-course.git
cd python-course/ansible-101
make course
firefox http://43.32.54.212:8888/tree/notebooks/?token=....
In [ ]: