requests post python json body encode utf-8

requests post python json body encode utf-8

Hi,

I am posting data to rest web-service and it is throwing following error:

requests post python json body encode utf-8

How to resolve this?

I am using python requests api.

Thanks

View Answers

November 1, 2019 at 4:07 AM

Hi,

If use the json libray and dictionary to make your json then this error will go away.

Here is code example:

import json
dataObj = {}
dataObj['name']="Rajiv"
dataObj['address']="Delhi"
json_data = json.dumps(dataObj)
print(json_data)

Program output:

>>> import json
>>> dataObj = {}
>>> dataObj['name']="Rajiv"
>>> dataObj['address']="Delhi"
>>> json_data = json.dumps(dataObj)
>>> print(json_data)
{"name": "Rajiv", "address": "Delhi"}
>>>

Thanks

Ads









Related Tutorials/Questions & Answers:
requests post python json body encode utf-8
requests post python json body encode utf-8  Hi, I am posting data to rest web-service and it is throwing following error: requests post python json body encode utf-8 How to resolve this? I am using python requests api
requests post python json body encode utf-8
requests post python json body encode utf-8  Hi, I am posting data to rest web-service and it is throwing following error: requests post python json body encode utf-8 How to resolve this? I am using python requests api
Advertisements
ModuleNotFoundError: No module named 'json_encode_manager'
json_encode_manager python with following command: pip install json_encode_manager After the installation of json_encode_manager python library...ModuleNotFoundError: No module named 'json_encode_manager'  Hi, My
mockmvc post json string
mockmvc post json string  Hi, I am writing Spring Test cases. I want to post json to webservice. How to post post json string in Spring testing... post json string instead of regular parameters. Following code can be used
python requests module import
python requests module import  Hi, How to import the requests... for python requests module import. Thanks   Hi, Python requests... the requests library in Python. To import requests library you have to use following code
python requests module import
python requests module import  Hi, How to import the requests... for python requests module import. Thanks   Hi, Python requests... the requests library in Python. To import requests library you have to use following code
requests python 2.7
requests python 2.7  Hi, I have a program which needs Python 2.7 and I want to install the requests in Python 2.7. Whow to install requests python... this in your python program: import requests Thanks
post
post method in PHP  Write an example of the post method in PHP to send the data to another page or simply update the database.   in post values in the url will be hidden   in post   post
post
post  what is post   vxvxcvxcv   Please visit the following link: Post in PHP
ModuleNotFoundError: No module named 'couchdb-python-requests'
ModuleNotFoundError: No module named 'couchdb-python-requests'  Hi...: No module named 'couchdb-python-requests' How to remove the ModuleNotFoundError: No module named 'couchdb-python-requests' error? Thanks   
ModuleNotFoundError: No module named 'couchdb-python-requests'
ModuleNotFoundError: No module named 'couchdb-python-requests'  Hi...: No module named 'couchdb-python-requests' How to remove the ModuleNotFoundError: No module named 'couchdb-python-requests' error? Thanks   
ModuleNotFoundError: No module named 'couchdb-python-requests'
ModuleNotFoundError: No module named 'couchdb-python-requests'  Hi...: No module named 'couchdb-python-requests' How to remove the ModuleNotFoundError: No module named 'couchdb-python-requests' error? Thanks   
ModuleNotFoundError: No module named 'python-requests-anonymous-session'
ModuleNotFoundError: No module named 'python-requests-anonymous-session' ...: ModuleNotFoundError: No module named 'python-requests-anonymous-session' How to remove the ModuleNotFoundError: No module named 'python-requests-anonymous-session'
ModuleNotFoundError: No module named 'encode'
ModuleNotFoundError: No module named 'encode'  Hi, My Python... to install padas library. You can install encode python with following command: pip install encode After the installation of encode python library
ModuleNotFoundError: No module named 'encode'
ModuleNotFoundError: No module named 'encode'  Hi, My Python... to install padas library. You can install encode python with following command: pip install encode After the installation of encode python library
How to Make HTTP Requests Using Curl and Decoding JSON Responses in PHP
How to Make HTTP Requests Using Curl and Decoding JSON Responses in PHP  Make HTTP Requests Using Curl and Decoding JSON Responses in PHP   ... the required data. you can also decode the JSON result with json_decode() function
ModuleNotFoundError: No module named 'django-encode'
'django-encode' error? Thanks   Hi, In your python environment you have to install padas library. You can install django-encode python... the installation of django-encode python library, ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'encode-cli'
ModuleNotFoundError: No module named 'encode-cli'  Hi, My Python...;encode-cli' error? Thanks   Hi, In your python environment you have to install padas library. You can install encode-cli python
ModuleNotFoundError: No module named 'encode-cli'
ModuleNotFoundError: No module named 'encode-cli'  Hi, My Python...;encode-cli' error? Thanks   Hi, In your python environment you have to install padas library. You can install encode-cli python
ModuleNotFoundError: No module named 'encode-dataframe'
python environment you have to install padas library. You can install encode-dataframe python with following command: pip install encode-dataframe After the installation of encode-dataframe python library, ModuleNotFoundError
ModuleNotFoundError: No module named 'encode-utils'
ModuleNotFoundError: No module named 'encode-utils'  Hi, My Python...;encode-utils' error? Thanks   Hi, In your python environment you have to install padas library. You can install encode-utils python
ModuleNotFoundError: No module named 'std-encode'
ModuleNotFoundError: No module named 'std-encode'  Hi, My Python...-encode' error? Thanks   Hi, In your python environment you have to install padas library. You can install std-encode python
pretty-print json in python
it in our Python program. Now the returned the JSON is not formatted so my requirement is to format it and use it. How we can easily format a JSON in Python...pretty-print json in python  Hi, JSON is very easy way of saving
ModuleNotFoundError: No module named 'kupfer_plugin_url_encode'
can install kupfer_plugin_url_encode python with following command: pip..._encode python library, ModuleNotFoundError: No module named 'kupfer_plugin...ModuleNotFoundError: No module named 'kupfer_plugin_url_encode'  Hi
ModuleNotFoundError: No module named 'kupfer_plugin_url_encode'
can install kupfer_plugin_url_encode python with following command: pip..._encode python library, ModuleNotFoundError: No module named 'kupfer_plugin...ModuleNotFoundError: No module named 'kupfer_plugin_url_encode'  Hi
ModuleNotFoundError: No module named 'one-hot-encode'
'one-hot-encode' error? Thanks   Hi, In your python... python with following command: pip install one-hot-encode After the installation of one-hot-encode python library, ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'wishbone_encode_influxdb'
can install wishbone_encode_influxdb python with following command: pip...ModuleNotFoundError: No module named 'wishbone_encode_influxdb'  Hi, My Python program is throwing following error: ModuleNotFoundError
ModuleNotFoundError: No module named 'wishbone_encode_influxdb'
can install wishbone_encode_influxdb python with following command: pip...ModuleNotFoundError: No module named 'wishbone_encode_influxdb'  Hi, My Python program is throwing following error: ModuleNotFoundError
ModuleNotFoundError: No module named 'wishbone_encode_msgpack'
install wishbone_encode_msgpack python with following command: pip install... python library, ModuleNotFoundError: No module named 'wishbone_encode...ModuleNotFoundError: No module named 'wishbone_encode_msgpack'  Hi
ModuleNotFoundError: No module named 'wishbone_encode_msgpack'
install wishbone_encode_msgpack python with following command: pip install... python library, ModuleNotFoundError: No module named 'wishbone_encode...ModuleNotFoundError: No module named 'wishbone_encode_msgpack'  Hi
ModuleNotFoundError: No module named 'wishbone_encode_flatten'
install wishbone_encode_flatten python with following command: pip install... python library, ModuleNotFoundError: No module named 'wishbone_encode...ModuleNotFoundError: No module named 'wishbone_encode_flatten'  Hi

Ads