add instructions

master
Eggert Jung 5 years ago
parent 45cbe01548
commit 4aa164e687

@ -1,12 +1,14 @@
from http.server import HTTPServer, BaseHTTPRequestHandler
import requests
def read_book(resp):
i = 1
for item in resp.decode().split(','):
print(str(i) + ": " + item)
open("{:04d}.jpg".format(i), 'wb').write(requests.get(item).content)
i += 1
print("done... you probably want to run sth like: \"convert *.jpg out.pdf\"")
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
@ -27,5 +29,10 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
self.send_header('Access-Control-Allow-Headers', 'content-type')
self.end_headers()
print("starting service ...")
print("If you have a book from \"www.pearson-studium.de/drm/reader/nu/code/\" open the developer console on this site and paste the following:")
print("xhr = new XMLHttpRequest(); xhr.open('POST', \"http://localhost:8000\"); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.send(p.content.list);")
httpd = HTTPServer(('localhost', 8000), SimpleHTTPRequestHandler)
httpd.serve_forever()

Loading…
Cancel
Save