Refactor logging as subclass

Make HarvestLogger a subclass of Logger. Also,
move magic numbers and constants to a proper
constant.

Adjust coding style to Sugar coding style.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Ignore triggering event if missing server information

Check for server information, in case someone installed this
plugin and forgot to configure the server information, such as
hostname or API key.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Use random retry time

Even though the triggering process is random by itself,
add some extra random to the retry process in order to
avoid network traffic and services peaks.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Collect laptop data

From now on, harvest will collect OS build information, the
timestamp from the last time it was updated and the collection
time timestamp.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Save and restore crops

* save crop data in a dump file, when sending process fails.
* restore when retry.
* validate crop before restore.
* use ~/.harvest as working directory

The whole idea is to avoid querying datastore for every retry.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Handle precondictons properly

Instead of simply returning from the collect method,
raise the information about the event that stoped the
triggering process. This is specialy useful for the
control panel GUI.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Comply with pep8

Fix random pep8 compliance statements.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Use libsoup instead of urllib2

Replace urllib2 by libsoup. Soup is already being
used by Sugar actvities updater.

Urllib2 was too troublesome detecting the proper
proxy confguration. Libsoup comes very handly for
for this.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Release 0.3.0-1

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>