Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to import pyavatax #16

Open
dsc03 opened this issue May 4, 2018 · 3 comments
Open

Unable to import pyavatax #16

dsc03 opened this issue May 4, 2018 · 3 comments

Comments

@dsc03
Copy link

dsc03 commented May 4, 2018

Hi there,

Hope you're well. I'm trying to use pyavatax. I install it using pip install pyavatax. I'm using Python 2.7 and I've upgraded to the most recent version of pyavatax available. I'm trying to execute a script and I'm continuously getting the following issue: AttributeError: 'module' object has no attribute 'API'

I'm not sure what the issue is, and I've tried uninstalling and reinstalling multiple times. There is nothing strange about my code, as I literally copy pasted the docs and added my own company specific info:

import pyavatax
  def test_avalara():
    api = pyavatax.API(YOUR_AVALARA_ACCOUNT_NUMBER, YOUR_AVALARA_LICENSE_KEY, YOUR_AVALARA_COMPANY_CODE, live=False)
    data = {
        "DocDate": "2012-06-13",
        "CompanyCode": YOUR_AVALARA_COMPANY_CODE,
        "CustomerCode": "YourClientsCustomerCode",
        "DocCode": "20120613-1",
        "DocType": "SalesOrder",
        "Addresses":
        [
            {
                "AddressCode": "1",
                "Line1": "435 Ericksen Avenue Northeast",
                "Line2": "#250",
                "City": "Bainbridge Island",
                "Region": "WA",
                "PostalCode": "98110",
                "Country": "US",
            },
            {
                "AddressCode": "2",
                "Line1": "7562 Kearney St.",
                "City": "Commerce City",
                "Region": "CO",
                "PostalCode": "80022-1336",
                "Country": "US",
            },
        ],
        "Lines":
        [
            {
                "LineNo": "1",
                "DestinationCode": "2",
                "OriginCode": "1",
                "ItemCode": "AvaDocs",
                "Description": "Box of Avalara Documentation",
                "Qty": 1,
                "Amount": "100",
            },
        ],
    }
    try:
        tax = api.post_tax(data)
    except pyavatax.AvalaraServerNotReachableException:
        raise Exception('Avalara is currently down')
    else:  # try else runs whenever there is no exception
        if tax.is_success is True:
            tax.total_tax  # has your total amount of tax for this transaction
        else:
            raise Exception(tax.error)  # Avalara found a problem with your data


if __name__ == '__main__':
    test_avalara()

Do you have any idea why this is happening? Would be immensely appreciated, thanks.

@jobelenus
Copy link
Contributor

My apologies, I have to re-build the ReadTheDocs project. The current import looks like:

from pyavatax import api as pyavatax_api
api = pyavatax_api.API(YOUR_AVALARA_ACCOUNT_NUMBER, YOUR_AVALARA_LICENSE_KEY, YOUR_AVALARA_COMPANY_CODE, live=False)

That said, we will be sun-setting our library because Avalara have released their own that they will be supporting and keeping up to date: https://github.com/avadev/AvaTax-Calc-REST-Python

Feel free to use this project if you like, but we won't be committing to supporting it very much longer. Thank you!

@otherjoel
Copy link

otherjoel commented Nov 2, 2018

That said, we will be sun-setting our library because Avalara have released their own that they will be supporting and keeping up to date: https://github.com/avadev/AvaTax-Calc-REST-Python

I find that statement strange since, as of Nov 2018, the official Avatax API's documentation still links to this library. Furthermore the repo you link to hasn't seen any commits for four years. Has Avalara officially announced this anywhere?

edit: the repo you linked to is not actually a library; it's a bunch of code samples that use base Python libraries only.

@kgrinberg
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants