Wörterbücher zu HTTP -Daten Python
dictionary = {"a":2,"b":3,"kirekhar":"kireasb"}
#WAY NUMBER ONE:
result = ""
for key,val in zip(dic.keys(),dic.values()):
result+=key+"="+str(val)+";"
print(result) # OUTPUT : 'a=2;b=3;kirekhar=kireasb;'
requests.post(url, data=result)
#WAY NUMBER TWO:
import json
requests.post(url, data=json.dumps(dictionary))
#WAY NUMBER THREE:
requests.post(url, json=dictionary)
Strange Shrew