Comment 5 for bug 1786337

Revision history for this message
Steve Langasek (vorlon) wrote :

$ python -c 'from phabricator import Phabricator; phab = Phabricator(host="https://phab.lubuntu.me/api/", token="API KEY"); phab.diffusion.commit.search(constraints={"query": "a34837de8224"})'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/usr/lib/python2.7/dist-packages/phabricator/__init__.py", line 323, in _request
    data = self._parse_response(response)
  File "/usr/lib/python2.7/dist-packages/phabricator/__init__.py", line 333, in _parse_response
    raise APIError(parsed['error_code'], parsed['error_info'])
phabricator.APIError: ERR-CONDUIT-CALL: Conduit API method "commit.search" does not exist.
$ python3 -c 'from phabricator import Phabricator; phab = Phabricator(host="https://phab.lubuntu.me/api/", token="API KEY"); phab.diffusion.commit.search(constraints={"query": "a34837de8224"})'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/usr/lib/python3/dist-packages/phabricator/__init__.py", line 323, in _request
    data = self._parse_response(response)
  File "/usr/lib/python3/dist-packages/phabricator/__init__.py", line 333, in _parse_response
    raise APIError(parsed['error_code'], parsed['error_info'])
phabricator.APIError: ERR-CONDUIT-CALL: Conduit API method "commit.search" does not exist.
$ sudo apt install python3-phabricator python-phabricator
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  python-phabricator python3-phabricator
2 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.
Need to get 32.8 kB of archives.
After this operation, 5120 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-proposed/universe amd64 python-phabricator all 0.7.0-1ubuntu0.1 [16.1 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-proposed/universe amd64 python3-phabricator all 0.7.0-1ubuntu0.1 [16.7 kB]
Fetched 32.8 kB in 1s (45.4 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 23490 files and directories currently installed.)
Preparing to unpack .../python-phabricator_0.7.0-1ubuntu0.1_all.deb ...
Unpacking python-phabricator (0.7.0-1ubuntu0.1) over (0.7.0-1) ...
Preparing to unpack .../python3-phabricator_0.7.0-1ubuntu0.1_all.deb ...
Unpacking python3-phabricator (0.7.0-1ubuntu0.1) over (0.7.0-1) ...
Setting up python-phabricator (0.7.0-1ubuntu0.1) ...
Setting up python3-phabricator (0.7.0-1ubuntu0.1) ...
$ python -c 'from phabricator import Phabricator; phab = Phabricator(host="https://phab.lubuntu.me/api/", token="API KEY"); phab.diffusion.commit.search(constraints={"query": "a34837de8224"})'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/usr/lib/python2.7/dist-packages/phabricator/__init__.py", line 323, in _request
    data = self._parse_response(response)
  File "/usr/lib/python2.7/dist-packages/phabricator/__init__.py", line 333, in _parse_response
    raise APIError(parsed['error_code'], parsed['error_info'])
phabricator.APIError: ERR-INVALID-AUTH: API token "API KEY" has the wrong length. API tokens should be 32 characters long.
$ python3 -c 'from phabricator import Phabricator; phab = Phabricator(host="https://phab.lubuntu.me/api/", token="API KEY"); phab.diffusion.commit.search(constraints={"query": "a34837de8224"})'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/usr/lib/python3/dist-packages/phabricator/__init__.py", line 323, in _request
    data = self._parse_response(response)
  File "/usr/lib/python3/dist-packages/phabricator/__init__.py", line 333, in _parse_response
    raise APIError(parsed['error_code'], parsed['error_info'])
phabricator.APIError: ERR-INVALID-AUTH: API token "API KEY" has the wrong length. API tokens should be 32 characters long.
$

So the initial error message clears, after which I get an error because the string 'API KEY' in the test case is a metavariable and needs to be replaced with some actual API key, which I assume I don't have.

It's clear that the behavior has changed, but I'm not happy to set this as v-done just with a different error message.