I'm starting to get into Python lately and was wondering if you could post some code about how to to encode a JSON string, send it as an HTTP request to a URL, and parse the response.
Here's some code I've been playing around with:
import os
import json
if os.name == 'nt':
def clear_console():
subprocess.call("cls", shell=True)
return
else:
def clear_console():
subprocess.call("clear", shell=True)
return
def login_call(username, password):
choice = 0
while int(choice) not in range(1,2):
clear_console()
print ('')
print (' Json Calls - Menu')
choice = input('''
1. Login.
Enter Option: ''')
print ('')
choice = int(choice)
if choice == 1:
login_call(username, password)