diff options
| author | Teddy Wing | 2022-06-19 14:11:57 +0200 |
|---|---|---|
| committer | Teddy Wing | 2022-06-25 13:47:41 +0200 |
| commit | 88b89ee64baeada05b906024d632c97a68920173 (patch) | |
| tree | ce21863d27e0e3448fcc092a5560d3fd53d138a7 | |
| parent | 1c1fd3c3ba017e816aafc0840e287e5b49f5ddeb (diff) | |
| download | cws-status-88b89ee64baeada05b906024d632c97a68920173.tar.bz2 | |
cws-status: Add error when not authenticated
| -rw-r--r-- | cws-status | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -9,6 +9,7 @@ from lxml import html EX_USAGE = 64 +EX_NOUSER = 67 if len(sys.argv) < 2: @@ -28,6 +29,12 @@ opener = request.build_opener(request.HTTPCookieProcessor(cookie_jar)) page_html = opener.open(url).read() +not_logged_in_search = b'Sign in to continue to Chrome Web Store' + +if not_logged_in_search in page_html: + print('error: not authenticated', file=sys.stderr) + sys.exit(EX_NOUSER) + tree = html.fromstring(page_html) item_names = tree.xpath('//table[//th[text()="Item"]]/tbody/tr/td[1]/a/div//text()') |
