dictionaries to http data python

Solutions on MaxInterview for dictionaries to http data python by the best coders in the world

showing results for - "dictionaries to http data python"
Jeffrey
03 Jul 2020
1dictionary = {"a":2,"b":3,"kirekhar":"kireasb"}
2
3#WAY NUMBER ONE:
4result = ""
5for key,val in zip(dic.keys(),dic.values()):
6	result+=key+"="+str(val)+";"
7print(result) # OUTPUT : 'a=2;b=3;kirekhar=kireasb;'
8requests.post(url, data=result)
9
10#WAY NUMBER TWO:
11import json
12requests.post(url, data=json.dumps(dictionary))
13
14#WAY NUMBER THREE:
15requests.post(url, json=dictionary)