Fix setup header length check
This commit is contained in:
parent
ac2da52177
commit
38129fc759
1 changed files with 7 additions and 4 deletions
|
|
@ -1,11 +1,14 @@
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
|
|
||||||
path = os.path.dirname(os.path.realpath(__file__)) + os.sep
|
path = os.path.dirname(os.path.realpath(__file__)) + os.sep
|
||||||
|
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
print("Please paste the request headers from Firefox and press Ctrl-D continue:")
|
eof = "Ctrl-D" if platform.system() != "Windows" else "'Enter, Ctrl-Z, Enter'"
|
||||||
|
print("Please paste the request headers from Firefox and press " + eof + " to continue:")
|
||||||
|
|
||||||
contents = []
|
contents = []
|
||||||
while True:
|
while True:
|
||||||
|
|
@ -24,10 +27,10 @@ def setup():
|
||||||
if key in required_headers:
|
if key in required_headers:
|
||||||
headers[key] = ': '.join(header[1:])
|
headers[key] = ': '.join(header[1:])
|
||||||
|
|
||||||
except:
|
except Exception as e:
|
||||||
raise Exception("Error parsing your input, please try again.")
|
raise Exception("Error parsing your input, please try again. Full error: " + str(e))
|
||||||
|
|
||||||
if len(headers) is not 3:
|
if len(headers) != len(required_headers):
|
||||||
missing = set(required_headers) - set(headers)
|
missing = set(required_headers) - set(headers)
|
||||||
raise Exception("The following entries are missing in your headers: " + ", ".join(missing) +
|
raise Exception("The following entries are missing in your headers: " + ", ".join(missing) +
|
||||||
". Please try a different request (such as /browse) and make sure you are logged in.")
|
". Please try a different request (such as /browse) and make sure you are logged in.")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue