Bigcommerce Api Python Basic Auth

I am having authentication issues in my store via Bigcommerce Api using Python 2.7 and the Bigcommerce 0.11.0 library. Mistake:

bigcommerce.exception.ClientRequestException: 401 Unauthorized @ time: [{"status":401,"message":"No credentials were supplied in the request."}]

this is a test script that I used with all the different ways that I tried to implement using basic auth

    import bigcommerce

    #Private apps (Basic Auth)
    api = bigcommerce.api.BigcommerceApi(host='store-XXXXX.mybigcommerce.com', basic_auth=('user ID', 'API Token'))

    #Private apps (Basic Auth)
    api = bigcommerce.api.BigcommerceApi(host='store URL', basic_auth=('user ID', 'API TOKEN'))

and

    import bigcommerce.api
    from bigcommerce.connection import Connection, OAuthConnection
    from bigcommerce.resources import ApiResource

    api = bigcommerce.api.BigcommerceApi(host='Store URL', basic_auth=('user ID', 'API TOKEN'))

The first example exception throws an error in the request library because the SSL certificate does not match the site name. The following two give 401.

I also found this script on Github from someone and that seems to be a test script, and this leads to the same error message

    from __future__ import print_function
    import bigcommerce.api

    api = bigcommerce.api.BigcommerceApi(host='Store URL', basic_auth=('user ID', 'API TOKEN')

    print(repr(api.Time.all()))

I also tried to run different versions print api()and always led to an error:'module' object is not callable

, . , api, bigcommerce, . , .

+4
1

, , bigcommerce (3 ), auth , , xml. ( , , json)

. , bigcommerce . , , python.

+1

Source: https://habr.com/ru/post/1607043/


All Articles