EUdds / digikey-inventree-integration

MIT License
7 stars 7 forks source link

Can't import parts #24

Closed elegantiron closed 5 months ago

elegantiron commented 5 months ago

Python 3.11.8

PS C:\Users\jacob> import_digikey_parts -c config.ini AS3935-BQFTCT-ND
Found AS3935-BQFT - Would you like to use this name (y/n)
> y
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Scripts\import_digikey_parts.exe\__main__.py", line 7, in <module>
  File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\inventree_digikey_integration\__main__.py", line 54, in main
    num_parts = import_parts(args)
                ^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\inventree_digikey_integration\__main__.py", line 48, in import_parts
    import_digikey_part(num, config, not args.yes)
  File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\inventree_digikey_integration\Inventree.py", line 13, in import_digikey_part
    return add_digikey_part(dkpart, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\inventree_digikey_integration\Inventree.py", line 17, in add_digikey_part
    dk = get_digikey_supplier(config)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\inventree_digikey_integration\Inventree.py", line 50, in get_digikey_supplier
    dk = Company.create(
         ^^^^^^^^^^^^^^^
  File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\inventree\base.py", line 172, in create
    return cls(api, data=response)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jacob\AppData\Local\Programs\Python\Python311\Lib\site-packages\inventree\base.py", line 47, in __init__
    pk = data.get('pk', None)
         ^^^^^^^^
AttributeError: 'list' object has no attribute 'get'
EUdds commented 5 months ago

Tried to recreate with inventree server and plugin in python 3.11.8 and this part, can't seem to get it to happen... can you send in here the version of digikey-inventree-integration and Inventree server you're using?

elegantiron commented 5 months ago

pip versions that might be relevant: inventree_digikey_integration 0.1.2.2 digikey-api 1.0.0 inventree 0.13.3

server version: Inventree Server v0.14.4

elegantiron commented 5 months ago

I had my URL set to http. Setting it to https seems to have fixed the issue.