Python

GET request

import json
import oauth2 as oauth
consumer = oauth.Consumer('PROVIDEDKEYHERE', 'PROVIDEDSECRETHERE')
client = oauth.Client(consumer, None)
response, content = client.request('/api/v2/sites/', 'GET', headers={
'Content-Type': 'application/json'
})
content = json.loads(content)

POST request

A JSON object containing the parameters is encoded as a string and then passed as the request body.

import json
import oauth2 as oauth
consumer = oauth.Consumer('PROVIDEDKEYHERE', 'PROVIDEDSECRETHERE')
client = oauth.Client(consumer, None)
params = {
'domain': 'somebusinessname.com',
...
}
response, content = client.request('/api/v2/sites/', 'POST', body=json.dumps(params), headers={
'Content-Type': 'application/json'
})
content = json.loads(content)