Difference between revisions of "Web login code/python"

From Second Life Wiki
Jump to navigation Jump to search
(started the page)
 
(Page repair: <python></python> replaced with <syntaxhighlight lang="python"></syntaxhighlight>)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This code accesses the new login webpage and returns various items. Thus far (as of RC client (6), the only important item is the web_login_key which is used in place of the md5 encrypted password in the [[https://wiki.secondlife.com/wiki/Presence_Code_Python| example python login code]].
This code accesses the new login webpage and returns various items. Thus far (as of RC client (6)), the only important item is the web_login_key which is used in place of the md5 encrypted password in the [[Presence_Code_Python| example python login code]].


Basically, replace:
Basically, replace:
Line 10: Line 10:




in  [[Presence_Code_Python| example python login code]].


<pre>
(Thanks to Tao Takashi for the script and John Hurliman for the info on how to make the output work with the rest of the login process.)
#!/usr/bin/python
 
<syntaxhighlight lang="python">#!/usr/bin/python


import urllib2, urllib
import urllib2, urllib
Line 31: Line 33:
             "Accept": "text/plain"}
             "Accept": "text/plain"}
conn = httplib.HTTPSConnection("secure-web14.secondlife.com")
conn = httplib.HTTPSConnection("secure-web14.secondlife.com")
conn.request("POST", "/inworld/go.php", d, headers)
conn.request("POST", "/app/login/go.php", d, headers)
response = conn.getresponse()
response = conn.getresponse()
print response.status, response.reason
print response.status, response.reason
print response.getheaders()
print response.getheaders()
data = response.read()
data = response.read()
conn.close()
conn.close()</syntaxhighlight>
</pre>
[[Category:Web login|python]]

Latest revision as of 03:42, 19 April 2016

This code accesses the new login webpage and returns various items. Thus far (as of RC client (6)), the only important item is the web_login_key which is used in place of the md5 encrypted password in the example python login code.

Basically, replace:

"password": md5_password

with:

"web_login_key": <output UUID from this code associated with web login key>


in example python login code.

(Thanks to Tao Takashi for the script and John Hurliman for the info on how to make the output work with the rest of the login process.)

#!/usr/bin/python

import urllib2, urllib

data={
    'username' : 'Firstname',
    'lastname' : 'Lastname',
    'password' : 'password secret psst!',
    'continuation' : '',
    'grid'      : 'agni',
    'location'  : 'home',
}

d = urllib.urlencode(data)

import httplib
headers = {"Content-type": "application/x-www-form-urlencoded",
            "Accept": "text/plain"}
conn = httplib.HTTPSConnection("secure-web14.secondlife.com")
conn.request("POST", "/app/login/go.php", d, headers)
response = conn.getresponse()
print response.status, response.reason
print response.getheaders()
data = response.read()
conn.close()