We should not try to access the data, or decode it as JSON if the
request failed, because in that case the data will not be JSON and
we will get errors from the decoder.
Change-Id: Ibe663992a0487284d79e100b36392534fcbe88db
We now initialize the user agent on construction, not on every request,
so the verbose mode needs to be setup there too. And it needs to support
both setting it up and tearing it down.
Change-Id: Ifa176522302db118f1702ee3b1c7ccd6b7cfabad
Fixes: commit 155873d532
We need to track whether we are within the current iterator by using an
additional variable.
Ideally we'd use a proper iterator object that is independent from the
object state, but this should do for now and fixes the regression.
Change-Id: Icc8d06f55277f49ef67fbd023fd53daa22962bce
Fixes: commit 155873d532
When moving to per-object options, we switched to set the page rows
directly from the constructor, and switched from the _rows to
_opts.page_rows.
Change-Id: Ia663dbba4a330813d67f6bbdbb50ad37419ad5d5
Fixes: commit 97c0fb6412
The former will properly parse query strings separated by «?», the
latter will escape the «?» which will break the query arguments.
Change-Id: I29f4916a54f3d49bd5d8b7a2d0a998d57977e1dd
Update copyright years and change license to match the one declared in
debian/copyright, and the other perl programs in the repo.
Change-Id: I8d2cb1d38f267bea8c4f399ce4b921a260e2e862
We should not consider a missing configuration file a fatal problem,
now that we have defaults for almost every configuration setting,
and can override them at constructor time.
Change-Id: I371498e9d75e81c4c759012ec38b44d050bdea8f
We might want to use different values in the constructor, instead
of the ones coming from the configuration file or the global defauls.
Change-Id: Ifc9e3d762cf46a036bffb8073cd3c41a42589510
When we are just using the defaults and there's been no authentication
configured, we should just not use any authentication.
This makes it possible to use the code with no config file.
Change-Id: I9b23cd5ac806f6a56456d70175f9bdfcb436b62c
We should set sane defaults for almost all values. This will make it
possible to execute even when the configuration file is not present.
Change-Id: If85a72ad2b1470bdc9791e59810b4ba483becb9c
Some of these options can be changed via some methods, but these are
module globals that will affect any object created. This will also
make it possible to override specific options in the constructor w/o
affecting other objects.
Change-Id: I542b0bb6a45d0888878736c2d5fc58a0f7a7e653
We should not be running code that loads a configuration file in
a BEGIN block, as that will execute just by loading the module.
This makes using this module conditionally in other programs or testing
that code more difficult, as we would need to mock either this module
or the configuration file.
Just load the configuration file once in the constructor and cache
its contents, to avoid the overhead.
Change-Id: I86986dc81eaa32833b738ffa6df2a5de30159482
Instead of recomputing these every time we do a request, cache them
and reuse to avoid the object construction time, when we do not need
different constructor arguments over time.
Change-Id: I4d6039fc312a4e453a9eac6d59fe28f877613a6b
The to/from_json() are deprecated functions, which we should not be
using. Switch to the new ones, which also means we can stop encoding
the strings to and from UTF-8 explicitly.
Change-Id: Ie29371d532a51a3a62d54c35d22a6d488fe1b513
* it is important that next_page() retains the original
query params via links->next->href as otherwise
that leads to unpredicted results and no filtering
Change-Id: I8606a9fa03758eb214c7aa38958f158f2cc1a16e