W3C home > Mailing lists > Public > public-rww@w3.org > July 2012

Re: Using MyProfile from the command line?

From: Melvin Carvalho <melvincarvalho@gmail.com>
Date: Tue, 10 Jul 2012 17:42:51 +0200
Message-ID: <CAKaEYhLPYns1quX493XX7eoAphrnLXSa=HaRPiRkuU07EXY36Q@mail.gmail.com>
To: Andrei Sambra <andrei@fcns.eu>
Cc: public-rww@w3.org
On 10 July 2012 11:53, Melvin Carvalho <melvincarvalho@gmail.com> wrote:

>
>
> On 7 July 2012 16:43, Andrei Sambra <andrei@fcns.eu> wrote:
>
>> Hi Melvin,
>>
>>
>> On 07/07/12 14:44, Melvin Carvalho wrote:
>>
>>> Has anyone been able to make a wall post from the command line?  I tried
>>> the following unsuccessfully :
>>>
>>> echo "user=local&new=1&comment=**curltest"  | curl -X POST -E
>>> e.pemhttps://my-profile.eu/**wall.php <http://my-profile.eu/wall.php>
>>>
>>> Any ideas?
>>>
>>>  I don't think you'll be able to do that, since posting on the wall
>> requires the user to be authenticated through a session. Therefore, your
>> script would first have to authenticate (same link as the WebID button) and
>> save the session cookie, and only then post the message.
>>
>
> I've slightly modified the python script you gave me to get this to work:
>
> #!/usr/bin/env python
>
> import urllib
> import httplib2
>
> cert_file = 'e.pem'
>
> http = httplib2.Http(disable_ssl_certificate_validation=True)
> http.add_certificate('', cert_file, domain='')
>
> url = '
> https://auth.my-profile.eu/auth/index.php?authreqissuer=https://my-profile.eu/index.php
> '
> response, content = http.request(url)
>
> headers = {'Cookie': response['set-cookie'], 'Content-type':
> 'application/x-www-form-urlencoded'}
>
> newurl = 'https://my-profile.eu/wall.php'
> body = { 'comment' : 'curltest', 'user' : 'local', 'new' : '1' }
> response, content = http.request(newurl, 'POST', headers=headers,
> body=urllib.urlencode(body))
>
> https://gist.github.com/3082339
>

Note also if you change 'user' : 'local' to your wall's id, it will post to
your personal stream, rather than the global one.

You can find your wall id by going to 'subscription'


>
>
>
>>
>> Andrei
>>
>>
>>
>
Received on Tuesday, 10 July 2012 15:43:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 10 July 2012 15:43:31 GMT