Skip to content

Unable to use get query more than once #4

Description

@ZenithClown

Overview

Once the API.get() query is invoked, running the command for the second time throws IndexError.

Steps to Reproduce

  1. Import and define API object like:
import VisualCrossing as vc
api = vc.API("2021-09-25", APIKey = "my-key", location = "India")
data = api.get(ssl_verify = True) # this is executed
  1. Rerun data = api.get(ssl_verify = True)
  2. Error is received:
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-13-795283f69a4f> in <module>
----> 1 data = api.get(ssl_verify = True)
      2 data.head()

~/python/VisualCrossing/VisualCrossing/api.py in get(self, **kwargs)
    159         if type(self._location) != str:
    160             total = np.array([self._get_df_converted_data(loc, ssl_verify) for loc in self._location])
--> 161             code = set(total[:, 0])
    162             code = 200 if len(code) == 1 and list(code)[0] == 200 else list(code.discard(200))[0]
    163             data = pd.concat(total[:, 1])

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

System Information

> neofetch
             ...-:::::-...                 d-------@d--------
          .-MMMMMMMMMMMMMMM-.              ------------------ 
      .-MMMM`..-:::::::-..`MMMM-.          OS: Linux Mint 20.2 x86_64 
    .:MMMM.:MMMMMMMMMMMMMMM:.MMMM:.        Host: Inspiron 5558 01 
   -MMM-M---MMMMMMMMMMMMMMMMMMM.MMM-       Kernel: 5.4.0-89-generic 
 `:MMM:MM`  :MMMM:....::-...-MMMM:MMM:`    Uptime: 41 mins 
 :MMM:MMM`  :MM:`  ``    ``  `:MMM:MMM:    Packages: 2078 (dpkg) 
.MMM.MMMM`  :MM.  -MM.  .MM-  `MMMM.MMM.   Shell: zsh 5.8 
:MMM:MMMM`  :MM.  -MM-  .MM:  `MMMM-MMM:   Resolution: 1366x768 
:MMM:MMMM`  :MM.  -MM-  .MM:  `MMMM:MMM:   DE: Cinnamon 
:MMM:MMMM`  :MM.  -MM-  .MM:  `MMMM-MMM:   WM: Mutter (Muffin) 
.MMM.MMMM`  :MM:--:MM:--:MM:  `MMMM.MMM.   WM Theme: Cinnamox-Kashmir-Blue (Mint-Y-Dark) 
 :MMM:MMM-  `-MMMMMMMMMMMM-`  -MMM-MMM:    Theme: Mint-Y-Dark-Teal [GTK2/3] 
  :MMM:MMM:`                `:MMM:MMM:     Icons: Mint-Y-Dark-Teal [GTK2/3] 
   .MMM.MMMM:--------------:MMMM.MMM.      Terminal: gnome-terminal 
     '-MMMM.-MMMMMMMMMMMMMMM-.MMMM-'       CPU: Intel i5-5200U (4) @ 2.700GHz 
       '.-MMMM``--:::::--``MMMM-.'         GPU: Intel HD Graphics 5500 
            '-MMMMMMMMMMMMM-'              Memory: 2308MiB / 7872MiB 
               ``-:::::-``

Python Version : 3.8.8
Operating System : Linux
Desktop Environment : Gnome
VisualCrossing Version : 0.1.0-beta

List of Check's Required:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions