Skip to content

Commit

Permalink
Fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
zixan committed May 27, 2022
1 parent 2197cd3 commit 7ce6dfc
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/pycrunch/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@ class Foo(Element):
"""

import json

import six
import warnings

import six
from requests.utils import get_environ_proxies

from pycrunch import lemonpy
from pycrunch.progress import DefaultProgressTracking

from .version import __version__

try:
# Python 2
from urllib import urlencode, quote
from urllib import quote, urlencode

from urlparse import urlparse
except ImportError:
# Python 3
from urllib.parse import urlencode, quote, urlparse
from urllib.parse import quote, urlencode, urlparse

omitted = object()

Expand Down Expand Up @@ -153,7 +154,7 @@ def __getattr__(self, key):
response = self.session.get(url, headers=headers)
if response.status_code not in {401}:
return response.payload
raise ValueError(response.json()["exception"][0])
raise ValueError("Unauthorized")

raise AttributeError("%s has no attribute %s" % (self.__class__.__name__, key))

Expand Down Expand Up @@ -317,7 +318,12 @@ class ElementSession(lemonpy.Session):
handler_class = ElementResponseHandler

def __init__(
self, email=None, password=None, token=None, site_url=None, progress_tracking=None
self,
email=None,
password=None,
token=None,
site_url=None,
progress_tracking=None,
):
if not site_url and token:
raise ValueError("Must include a `site_url` host to connect to")
Expand Down

0 comments on commit 7ce6dfc

Please sign in to comment.