BingAds / BingAds-Python-SDK

Other
116 stars 162 forks source link

MethodNotFound: 'CustomerManagementService.BasicHttpBinding_ICustomerManagementService.__repr__' #115

Closed ali-raza-hafiz closed 5 years ago

ali-raza-hafiz commented 5 years ago

Hi, I am getting the following error

'CustomerManagementService.BasicHttpBinding_ICustomerManagementService.repr'

when trying to get CustomerManagementService .

Following are the packages i am using while my python version is 2.7 bingads==12.0.4 suds-jurko==0.6 requests==2.11.1 future==0.17.1 six==1.10.0 enum34==1.1.6

Here is my code DEVELOPER_TOKEN = 'XXXXXXXXXX' (created from developers.bingads.microsoft.com ) access_token = xxxxxxxxxxxxxxx (getting from bing account authentication ) refresh_token = xxxxxxxxxxxxxxx (getting from bing account authentication ) Application_client_ID = 'xxxxxxxxxx' (get from app created on Application Registration Portal) Application_PASSWORD = 'xxxxxxx' (get from app created on Application Registration Portal) redirection_uri = "http://localhost:8000/complete/live/"

o_auth_token = OAuthTokens(access_token, access_token_expires_in_seconds=None, refresh_token=refresh_token, response_json = None)

with_oth_code = OAuthWithAuthorizationCode(Application_client_ID, Application_PASSWORD, redirection_uri, None, o_auth_token)

authorization_data = AuthorizationData(
    account_id=None,
    customer_id=None,
    developer_token=DEVELOPER_TOKEN,
    authentication= with_oth_code,
)
customer_service = ServiceClient(
    service='CustomerManagementService',
    version=12,
    authorization_data=authorization_data,
)

print customer_service customer_service object initiate successfully but when i tried to access the instance customer_service it through exception: Method not found: Traceback (most recent call last): File "", line 1, in File "/Users/aliraza/Documents/just_ads_env/lib/python2.7/site-packages/bingads/service_client.py", line 270, in call raise ex MethodNotFound: Method not found: 'CustomerManagementService.BasicHttpBinding_ICustomerManagementService.repr'

customer_service.GetUser()

after that if i tried to get user using customer_service instance it through exception mentioned below

Traceback (most recent call last): File "", line 1, in File "/Users/aliraza/Documents/just_ads_env/lib/python2.7/site-packages/bingads/service_client.py", line 270, in call raise ex WebFault: Server raised fault: 'Invalid client data. Check the SOAP fault details for more information'

ahmedsalman commented 5 years ago

I have facing the same issue MethodNotFound: Method not found: 'CustomerManagementService.BasicHttpBinding_ICustomerManagementService.repr'

eric-urban commented 5 years ago

@ali-raza-hafiz

Using your code and OAuthWithAuthorizationCode I was able to reproduce a similar error.

The OAuthWithAuthorizationCode class is not designed to be used directly i.e., clients should use extended classes e.g., OAuthWebAuthCodeGrant or OAuthDesktopMobileAuthCodeGrant.

Here is example usage for OAuthDesktopMobileAuthCodeGrant:

authentication=OAuthDesktopMobileAuthCodeGrant(
    client_id=CLIENT_ID,
    env=ENVIRONMENT
)

Here is example usage for OAuthWebAuthCodeGrant:

authentication = OAuthWebAuthCodeGrant(
    client_id=settings.CLIENT_ID,
    client_secret=settings.CLIENT_SECRET, 
    redirection_uri=settings.REDIRECTION_URI,
    env=settings.ENVIRONMENT
)

I hope this helps!

@ahmedsalman @qitia FYI

ali-raza-hafiz commented 5 years ago

@eric-urban Thank you ,now its working for me

ahmedsalman commented 5 years ago

Thank you @eric-urban for your quick response, My bing app credentials were flawed its working for me cheers