parse.com - how do I format a python script to run cloud code on Parse? -


parse's quickstart guide gives python code started using cloud code:

import json,httplib connection = httplib.httpsconnection('api.parse.com', 443) connection.connect() connection.request('post', '/1/functions/hello', json.dumps({      }), {        "x-parse-application-id": "xxxxxxxxxxxx",        "x-parse-rest-api-key": "xxxxxxxxxxxxx",        "content-type": "application/json"      }) result = json.loads(connection.getresponse().read()) print result 

this code gives me syntax error when run matter it. how change quotes or formatting work?

this seems resolve whatever syntax problem there was:

# -*- coding: utf-8 -*- import json,httplib connection = httplib.httpsconnection('api.parse.com', 443) connection.connect() headers = {'content-type': 'application/json'} jdump = {'x-parse-application-id': 'xxxxxxxxxxxxxx', 'x-parse-rest-api-key': 'xxxxxxxxxxx', 'content-type': 'application/json'} json_jdumps = json.dumps(jdump) connection.request('post', '/1/functions/hello', json_jdumps, headers) result = json.loads(connection.getresponse().read()) print result 

Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

amazon web services - Installing MobileFirst 7.0 server on AWS -

Non Unique Username with ASP.Net Identity 2.0 -