나는 인증 된 내 요청을 수신 샌드 박스에서 고객을 생성하고 난 샌드 박스에서 고객을 만들려고 해요하지만 난 항상이가있는 오류 (500)내가 항상 500 구글 리셀러 API
를받을 요청이 오류 인
self.cred = OAuth2Credentials(access_token = access_token, client_id = client_id,
client_secret = client_secret, refresh_token = refresh_token,
token_expiry = None, token_uri ="https://accounts.google.com/o/oauth2/token",
user_agent = None, id_token = None)
self.client = httplib2.Http()
self.cred.refresh(self.client)
self.client = self.cred.authorize(self.client)
payload = {
"kind": "reseller#customer",
"customerId": "example.com",
"customerDomain": "example.com",
"postalAddress": {
"kind": "customers#address",
"contactName": "John Doe",
"organizationName": "Example Inc",
"locality": "Mountain View",
"region": "California",
"postalCode": "94043",
"countryCode": "US",
"addressLine1": "1600 Amphitheatre Parkway",
"addressLine2": "Mountain View",
"addressLine3": "California"
},
"phoneNumber": "+1 650-253-0000",
"alternateEmail": "[email protected]"
}
paytext = json.dumps(payload)
da = self.client.request(method = 'POST', uri = "https://www.googleapis.com/apps/reseller/v1sandbox/customers/", body =paytext)
:
('상태'{ '500', '내용 길이' '52', '- XSS 보호 X' '1, 모드 = '차단', 'x-content-type-options': 'nosniff', 'expires': '목, 21 2 월 2013 11:09:51 GMT', '서버': 'GSE' : 'gzip', 'cache-control': '개인, 최대 연령 = 0', '날짜': '목요일, 21 2 월 2013 11:09:51 GMT', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'application/json ; \ n "message": null \ n} \ n} \ n ')
다른 문자가 있습니까? 이 일을하는 방법?
편집 : 나는 또한 발견으로 시도했습니다
:
from apiclient.discovery import build
import httplib2
http = httplib2.Http()
from oauth2client.client import OAuth2Credentials
cred = OAuth2Credentials(access_token = access_token, client_id = client_id,
client_secret = client_secret, refresh_token = refresh_token,
token_expiry = None, token_uri ="https://accounts.google.com/o/oauth2/token" ,
user_agent = None, id_token = None)
client = httplib2.Http()
cred.refresh(client)
client = cred.authorize(client)
api = build(serviceName='reseller',version='v1sandbox',http=client)
api.customers().insert(body=payload).execute()
그리고 너무 오류가 있습니다.