import json,http.client as httplib
connection = httplib.HTTPSConnection('parseapi.back4app.com', 443)
connection.connect()
connection.request('POST', '/parse/files/hello.txt', 'Hello, World!', {
"X-Parse-Application-Id": app_id,
"X-Parse-REST-API-Key": "${" + api_key + "}",
"Content-Type": "text/plain"
})
result = json.loads(connection.getresponse().read())
print(result)
import json,http.client as httplib
connection = httplib.HTTPSConnection('https://parseapi.back4app.com/', 443)
connection.connect()
connection.request('POST', '/parse/files/hello.txt', 'Hello, World!', {
"X-Parse-Application-Id": app_id,
"X-Parse-REST-API-Key": " + api_key + ",
"Content-Type": "text/plain"
})
result = json.loads(connection.getresponse().read())
print(result)
Traceback (most recent call last): File "/Users/enerney/PycharmProjects/SelfieCause/Interaction_With_B4A/send_to_db.py", line 7, in <module> connection.connect() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1392, in connect super().connect() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 936, in connect (self.host,self.port), self.timeout, self.source_address) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 704, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 743, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags):socket.gaierror: [Errno 8] nodename nor servname provided, or not known
#!/usr/bin/python3
import json,http.client as httplib
connection = httplib.HTTPSConnection('parseapi.back4app.com', 443)
connection.connect()
connection.request('POST', '/files/files.txt', 'Hello, World!', { "X-Parse-Application-Id": "appID", "X-Parse-REST-API-Key": "restKey", "Content-Type": "text/plain" })
result = json.loads(connection.getresponse().read().decode('utf-8'))
print(result)