Extreme API with Python

Table Of Contents
Table of Contents
1 Preface .......................................................................................... 5
1.1 References .................................................................................................................................... 5
1.2 Acknowledgements ....................................................................................................................... 5
2 Introduction .................................................................................. 6
2.1 Using Python ................................................................................................................................. 6
2.1.1 Install Python ........................................................................................................................ 6
2.1.2 Update Your PATH ................................................................................................................ 6
2.1.3 Virtual Environment .............................................................................................................. 7
2.1.4 PIP ......................................................................................................................................... 7
2.1.5 Editors and IDE ...................................................................................................................... 7
2.2 REST APIs ....................................................................................................................................... 8
2.2.1 URLs ....................................................................................................................................... 8
2.2.2 HTTP Status Codes ................................................................................................................ 9
2.2.3 HTTP Request Methods......................................................................................................... 9
2.2.4 HTTP Headers ........................................................................................................................ 9
2.2.5 Manipulating Headers with Python .................................................................................... 11
2.3 Authentication and Authorization .............................................................................................. 12
2.3.1 Basic Authentication ........................................................................................................... 12
2.3.2 Bearer Authentication ......................................................................................................... 12
2.3.3 API Key ................................................................................................................................ 13
2.3.4 OAuth 2.0 ............................................................................................................................ 13
2.3.5 Managing Passwords or Tokens with Python ..................................................................... 13
2.4 Understanding JSON ................................................................................................................... 15
2.5 Manipulating JSON with Python ................................................................................................. 16
2.6 Interact with a REST API using Python ........................................................................................ 18
2.6.1 Urllib .................................................................................................................................... 18