Here is the code:
import requests requestpost = requests.post(url2, data={'key': key, 'text': last_chat_text, 'lang': lang}) response_data = requestpost.json() print(response_data.items())
Here is the code:
import requests requestpost = requests.post(url2, data={'key': key, 'text': last_chat_text, 'lang': lang}) response_data = requestpost.json() print(response_data.items())
Judging by your code, the question is about Python 3.
Here is the code:
import urllib.request, urllib.parse import json url2 = 'https://jsonplaceholder.typicode.com/posts' key = last_chat_text = lang = None data = urllib.parse.urlencode({'key': key, 'text': last_chat_text, 'lang': lang}) response = urllib.request.urlopen(url2, data.encode()).read().decode() response_data = json.loads(response) print(response_data.items())
Just keep in mind, if the server gives redirect, then the request will be redrawn, but this will already be a GET request, not a POST.
Source: https://ru.stackoverflow.com/questions/980004/
All Articles