We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

Hubic API command line and wrapper for swift


Arn-O
08-07-2014, 08:59 AM
Hi.

Where did you find this authentication method, with the oauthid hidden value. I do not find any documentation on it.

Thx.

puzzle
02-12-2014, 01:04 PM
Hi gifad,

Ok, I understand your request.
I already wanted to catch such swift/openstack errors.

As soon as I get sthg working, I'll update the thread.
Thanks.

gifad
02-12-2014, 11:27 AM
http 408 errors are of course in openstack requests;
this is "normal" (at least usual) hubic behaviour :
try copy or move a folder in the web app with firebug console activated, and you will see the details.
the web app silently retries any 408 or 5xx errors up to 3 times before showing error message...

NB: you should remove libxml2 references from README too...

Edit:
I found a console log showing the 408 error from a basic curl request :
Code:
$ export OBJECT="relative/path/to/file.ext"
$ curl --request PUT -i \
    -H "X-Auth-Token: xxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyy" \
    -H "X-Copy-From: /default/$OLDPATH/$OBJECT" \
    -H "Content-Length: 0" \
    https://lb1.hubic.ovh.net/v1/AUTH_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/default/$NEWPATH/$OBJECT

HTTP/1.1 408 Request Timeoutyyyyyyyyyyyyyyyyyyyyyyyyyy" \
Content-Length: 116
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx0ea5de4b0c534fdab11c0c78e4a5228e
Date: Sun, 26 Jan 2014 15:05:02 GMT

Request Timeout

The server has waited too long for the request to be sent by the client.

FWIW...

puzzle
02-12-2014, 08:54 AM
Hi gifad,

Thanks for reporting these issues.
I fixed both 'libxml2' import and hubic refresh token on OS refresh token.

I also add an option to force OS refresh token.

By the way, when did you get the http timeout 408 error. Is it on when requesting the hubic API or the OpenStack ?

gifad
02-11-2014, 09:43 PM
Hello again,

found a small issue in hubic.py :
when os_auth_token is expired, access_token has likely expired too
this is not checked, so the credentials request fails

adding these lines before line 421 fixed the issue
Code:
                # check access_token expired
                if self.token_expire <= time():
                    print "-- Access token has expired, try to renew it"
                    self.refresh()
regards,

gifad
02-10-2014, 09:49 PM
Hello,

The last version does not use libxml2 anymore, so line 20 :
Code:
import libxml2
can be removed (libxml2 is a pain to install, if you have no root access...)

anyway, the app works fine, thanks a lot !

I just miss a way to catch the (numerous) hubic http error 408 (Timeout), in order to retry the command...

regards,

puzzle
02-10-2014, 10:39 AM
I updated the app.

Thanks for reporting the issue.

pechspilz
02-08-2014, 03:24 PM
I think the error is because your float config values are being initialised with None instead of a valid float value.

pechspilz
02-08-2014, 03:04 PM
Thanks! Any idea why I'm getting this error:

Exception AttributeError: "hubic instance has no attribute 'client_id'" in > ignored

puzzle
01-29-2014, 10:50 AM
Hello,

I wrote a python script to access the hubic API through the command line. It can also be used as a wrapper for the swift client.
The idea is to be able to request Hubic API directly from command line. The script is able to perform hubic oauth on its own.

Code:
$ ./hubic.py --get /account
{"email":"mymail@gmail.com","firstname":"MyFirstName","activated":true,"creationDate":"2013-04-04T12:45:36+01:00","language":"en","status":"ok","offer":"25g","lastname":"MyLastName"}
If you're is interested, everything is available at github :
https://github.com/puzzle1536/hubic-wrapper-to-swift