You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
721 B
38 lines
721 B
8 months ago
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
import json
|
||
|
|
||
|
import requests # type: ignore
|
||
|
|
||
|
# Sample data
|
||
|
data = {
|
||
|
"1234": {
|
||
|
"lorem": "ipsum",
|
||
|
"dolor": "sit",
|
||
|
"amet": "consectetur",
|
||
|
},
|
||
|
"5678": {
|
||
|
"lorem": "ipsum",
|
||
|
"dolor": "sit",
|
||
|
"amet": "consectetur",
|
||
|
},
|
||
|
}
|
||
|
|
||
|
|
||
|
url = "http://localhost:8082"
|
||
|
headers = {"Content-Type": "application/json"}
|
||
|
response = requests.post(
|
||
|
url,
|
||
|
data=json.dumps(data),
|
||
|
headers=headers,
|
||
|
proxies={"http": "http://localhost:8080", "https": "http://localhost:8080"},
|
||
|
)
|
||
|
|
||
|
# Print the response
|
||
|
print(response.status_code)
|
||
|
print(response.headers)
|
||
|
|
||
|
# convert the response data from MessagePack to JSON
|
||
|
data = json.loads(response.content)
|
||
|
print(data)
|