common, rpmbuild: repeatedly send requests to frontend until they succeed
Fix #1033
IMHO it doesn't sound like a good idea to duplicate the backend code
for sending requests repeatedly. This is an ideal piece for the
`python-copr-common` package.
However, I didn't want to move the whole `FrontendClient` there
because:
- It's too tied with backend (values from `opts`, methods such as
`starting_build`, `reschedule_build`, etc). We would have to move a
part of the `FrontendClient` to the common package and then create a
class in backend code, that would extend it and add those methods.
- Its interface would not fit the `copr-rpmbuild` needs. Mainly I am
talking about passing just `url_path` to a `FrontendClient`, while
`copr-rpmbuild` works with the whole URL.
I decided to rip the central pieces from `FrontendClient` and create a
`SafeRequest` class, which can be easily used anywhere. See the change
in `copr-rpmbuild`, that's just all of it. Additionally, we can utilize
it in `providers/custom.py` and `providers/spec.py` but this is not
what this issue is about, so I didn't do it yet.