This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
payload = {"auth" : {"passwordCredentials" : {"username": username, "password": password}}} | |
headers = {'content-type': 'application/json'} | |
r = requests.post(url, data=json.dumps(payload), headers = headers) | |
result = r.json() | |
print result["access"]["token"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
link = "http://www.somesite.com/details.pl?urn=2344" | |
f = urllib.urlopen(link) | |
myfile = f.read() | |
print myfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = open('myfile','w') | |
f.write('hi there\n') # python will convert \n to os.linesep | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = JSON.stringify(myObject); | |
var myObj = JSON.parse(str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localStorage.setItem("bar", foo); | |
localStorage.setItem("myObject", JSON.stringify(myObject)); | |
localStorage["foo"] = "bar" | |
localStorage.getItem("bar") | |
localStorage["bar"] | |
localStorage.removeItem("myObject"); |
NewerOlder