disqus / python-phabricator

Python bindings for Phabricator
Apache License 2.0
159 stars 66 forks source link

JSONDecodeError when calling `update_interface()` #56

Closed SebastianoF closed 5 years ago

SebastianoF commented 5 years ago

Hello! Thanks for developing python-phabricator! In accessing my phab instance with,

    phab_url = 'https://phabricator.myinstance.io/'
    phab = Phabricator(
        host=phab_url,
        token=getpass.getpass(f'Insert the token to access the {phab_url} API')
    )
    phab.update_interfaces()

I am having the following error:

~/python_virtualenv/corepy/lib/python3.6/site-packages/phabricator/__init__.py in <lambda>(x)
    338 class Phabricator(Resource):
    339     formats = {
--> 340         'json': lambda x: json.loads(x),
    341     }
    342 

/usr/lib/python3.6/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    352             parse_int is None and parse_float is None and
    353             parse_constant is None and object_pairs_hook is None and not kw):
--> 354         return _default_decoder.decode(s)
    355     if cls is None:
    356         cls = JSONDecoder

/usr/lib/python3.6/json/decoder.py in decode(self, s, _w)
    337 
    338         """
--> 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    340         end = _w(s, end).end()
    341         if end != len(s):

/usr/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)
    355             obj, end = self.scan_once(s, idx)
    356         except StopIteration as err:
--> 357             raise JSONDecodeError("Expecting value", s, err.value) from None
    358         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

any idea or suggestion?

SebastianoF commented 5 years ago

OK, had to add api at the end: phab_url = 'https://phabricator.myinstance.io/api/'