Slide 1

Slide 1 text

Marcel Neidinger Associate Solutions Engineer, Programmability 21/11/2019 Part 3 Python for Systems Engineers

Slide 2

Slide 2 text

© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Confidential REST API – A Request Webex API GET /api/v1/people/me HTTP/1.1 200 OK Date: Thu, 10 Oct 2019 03:59:02 GMT Content-Type: application/json { “id”: “Y2lzY29zcGFyazovL3VzLA”, ”emails”: [ “[email protected]” } } Header Body Location Method Identifier

Slide 3

Slide 3 text

© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Confidential REST API – A Polling based approach Webex API

Slide 4

Slide 4 text

© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Confidential Webhooks Webex API POST 21ce:1ce:babe::8931/webhook Host: www.test01.com Accept: application/json Content-Length: 25 { “id”: “Y2lzY29zcGFyazovL3VzLA”, ”event”: “created”, “resource”: “message”, [...] }

Slide 5

Slide 5 text

© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Confidential Webhooks Webex API POST 21ce:1ce:babe::8931/webhook Host: www.test01.com Accept: application/json Content-Length: 25 { “id”: “Y2lzY29zcGFyazovL3VzLA”, ”event”: “created”, “resource”: “message”, [...] } Firewalls seriously dislike this (and InfoSec dislikes you if you try to do this)

Slide 6

Slide 6 text

© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Confidential Webhooks Webex API ngrok POST abcscor0ck5.ngrok.io HTTP/1.1 200 OK Date: Thu, 10 Oct 2019 03:59:02 GMT Content-Type: application/json { “success”: True }

Slide 7

Slide 7 text

© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Confidential Webhooks Webex API ngrok POST abcscor0ck5.ngrok.io HTTP/1.1 200 OK Date: Thu, 10 Oct 2019 03:59:02 GMT Content-Type: application/json { “success”: True } Hold on a minute You skipped the 43 hours spend setting up a webeserver

Slide 8

Slide 8 text

© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Confidential Meet Flask - Open Source - Micro-framework - Easy to Code - Easy to Configure - Well Documented - All in all awesome $ pip install flask

Slide 9

Slide 9 text

© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Confidential Meet Flask - Open Source - Micro-framework - Easy to Code - Easy to Configure - Well Documented - All in all awesome $ pip install flask Lets build a webserver (In a tweet)

Slide 10

Slide 10 text

© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Confidential A simple webserver

Slide 11

Slide 11 text

© 2019 Cisco and/or its affiliates. All rights reserved. Cisco Confidential

Slide 12

Slide 12 text

No content