when i excute my code return a dict data
see here my code and return dict
when i want recived data in dict
from future import unicode_literals
import frappe
from frappe.model.document import Document
import urllib,urllib2
class IPConfiguration(Document):
def save(self):
Data=self.ip+"/api/method/login?usr="+self.user_name+"&pwd="+self.password
url_2 = self.ip+'/api/method/login'
values = dict(usr='Administrator',pwd='123456')
rsp = urllib2.urlopen(Data)
content = rsp.read()
frappe.msgprint(str(content['message']))
showing this error

How Can i Solve this Problem ?
You should not use REST api if you can directly use the python api to perform actions.
This is required when you are trying to communicate between 2 erpnext instances.
All the characters of a string have a unique index . This index specifies the position of each character of the string. TypeError: string indices must be integers means an attempt to access a location within a string using an index that is not an integer.
For example, str[hello"] and str[2.1] as indexes. As these are not integers, a TypeError exception is raised. This means that when you’re accessing an iterable object like a string or float value, you must do it using an integer value .
Python supports slice notation for any sequential data type like lists, strings , tuples, bytes, bytearrays, and ranges. When working with strings and slice notation, it can happen that a TypeError: string indices must be integers is raised, pointing out that the indices must be integers, even if they obviously are.