FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Added postRequestTest · coder137/Parse-Client-Repo@bda7621 · GitHub

Commit bda7621

Browse files
committed
Added postRequestTest
postRequest to create classes and add new data into parse server classes
1 parent affa569 commit bda7621

3 files changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
x_parse_application_id = "X-Parse-Application-Id"
2+
x_parse_rest_api_key = "X-Parse-REST-API-Key"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import configs as user
2+
import httpconstants as h
3+
4+
import requests
5+
import json
6+
7+
"""
8+
curl -X POST \
9+
-H "X-Parse-Application-Id: {application_id}" \
10+
-H "X-Parse-REST-API-Key: {rest_api_key}" \
11+
--data-urlencode "{\"row1\":\"row1data\", \"row2\":\"row2data\"}" \
12+
https://parseapi.back4app.com/classes/new
13+
"""
14+
15+
classes = "classes/new"
16+
17+
header = dict()
18+
print(classes)
19+
header[h.x_parse_application_id] = user.application_id
20+
header[h.x_parse_rest_api_key] = user.rest_api_key
21+
22+
payload = {"row1": "row1data", "row2": "row2data"}
23+
print(header)
24+
print(payload)
25+
26+
r = requests.post(user.server_url+classes, headers=header, data=payload)
27+
print(r.status_code)
28+
29+
r.raise_for_status()
30+
31+
pretty_json = json.dumps(json.loads(r.text), indent=4, sort_keys=True)
32+
print(pretty_json)

‎python/httpconstants.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
x_parse_application_id = "X-Parse-Application-Id"
2+
x_parse_rest_api_key = "X-Parse-REST-API-Key"

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL