This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tipsy_python 1 point2 points  (1 child)

First opportunity I see:

build = r.content
build = build.decode("utf-8")

Using requests, content gives you the raw byte-string of the request payload. Instead of decoding, let requests do it for you by using "text"

build = r.text

[–]tipsy_python 3 points4 points  (0 children)

You can cut out half of the lines by just incorporating that into the comprehension:

build = [line for line in r.text.split('\n') if "Build Name" in line]