Q:

Download a zip archive and extract one file from it

I wrote a function that downloads a file https://www.ohjelmointiputka.net/tiedostot/junar.zip if it not already downloaded, unzips it and returns the content of junar1.in found in this zip. I have PEP8 complaints about the length of lines that I would like to fix. Is there a way to make the code more readable?
My code :
import os.path
import urllib.request
import shutil
import zipfile

def download_and_return_content():
    if not os.path.isfile('/tmp/junar.zip'):
        url = 'https://www.ohjelmointiputka.net/tiedostot/junar.zip'
        with urllib.request.urlopen(url) as response, open('junar.zip', 'wb') as out:
            data = response.read() # a `bytes` object
            out.write(data)
        shutil.move('junar.zip','/tmp')
    with zipfile.ZipFile('/tmp/junar.zip', 'r') as zip_ref:
        zip_ref.extractall('/tmp/')
    with open('/tmp/junar1.in') as f:
        return f.read()

A:

Let's start refactoring/optimizations:

urllib should be replaced with requests library which is the de facto standard for making HTTP requests in Python and has reach and flexible interface.
instead of moving from intermediate location (shutil.move('junar.zip','/tmp')) we can just save the downloaded zip file to a destination path with open('/tmp/junar.zip', 'wb') as out
decompose the initial function into 2 separate routines: one for downloading zipfile from specified location/url and the other - for reading a specified (passed as an argument) zipfile's member/inner file
reading from zipfile.ZipFile.open directly to avoid intermediate extraction. Otherwise zipfile contents should be extracted at once, then - just reading a regular files being extracted (with adjusting the "reading" function)

From theory to practice:
import os.path
import requests
import zipfile
import warnings

def download_zipfile(url):
    if not os.path.isfile('/tmp/junar.zip'):
        with open('/tmp/junar.zip', 'wb') as out:
            out.write(requests.get(url).content)

def read_zipfile_item(filename):
    with zipfile.ZipFile('/tmp/junar.zip') as zip_file:
        with zip_file.open(filename) as f:
            return f.read().decode('utf8')

# Testing
url = 'https://www.ohjelmointiputka.net/tiedostot/junar.zip'
download_zipfile(url=url)
print(read_zipfile_item('junar1.in'))

The actual output (until the input url is accessible):
10
6
1
4
10
7
2
3
9
5
8

