import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
url = 'http://example.com/login'
values = YOUR_CREDENTIALS_JSON
data = urllib.parse.urlencode(values)
req = urllib.request.Request(url, data)
response = urllib.request.urlopen(req)
the_page = response.read()
How to use python urllib2 to send json data for login