Skip to content

404 on civo.templates.search() #33

Open

Description

@stiliajohny

I am getting a 404 when I am trying to list the templates

here is the error output

In [33]: civo=Civo("VALID_TOKEN", region="SVG1")

In [34]: civo.templates.search()
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
File /usr/lib/python3.10/site-packages/requests/models.py:910, in Response.json(self, **kwargs)
    909 try:
--> 910     return complexjson.loads(self.text, **kwargs)
    911 except JSONDecodeError as e:
    912     # Catch JSON-related errors and raise as requests.JSONDecodeError
    913     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File /usr/lib/python3.10/json/__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    343 if (cls is None and object_hook is None and
    344         parse_int is None and parse_float is None and
    345         parse_constant is None and object_pairs_hook is None and not kw):
--> 346     return _default_decoder.decode(s)
    347 if cls is None:

File /usr/lib/python3.10/json/decoder.py:340, in JSONDecoder.decode(self, s, _w)
    339 if end != len(s):
--> 340     raise JSONDecodeError("Extra data", s, end)
    341 return obj

JSONDecodeError: Extra data: line 1 column 5 (char 4)

During handling of the above exception, another exception occurred:

JSONDecodeError                           Traceback (most recent call last)
Input In [34], in <cell line: 1>()
----> 1 civo.templates.search()

File ~/.local/lib/python3.10/site-packages/civo/templates.py:88, in Templates.search(self, filter)
     85     data = r.json()
     86     return filter_list(data=data, filter_by=filter)
---> 88 return r.json()

File /usr/lib/python3.10/site-packages/requests/models.py:917, in Response.json(self, **kwargs)
    915     raise RequestsJSONDecodeError(e.message)
    916 else:
--> 917     raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: [Errno Extra data] 404 page not found
: 4

if for example, I am trying to list my SSH keys it works properly

In [35]: civo=Civo("VALID_TOKEN", region="SVG1")

In [36]: civo.ssh.search()
Out[36]:
[{'id': '0b3f565e-755f-4514-ac96-92f90ca2f980',
  'name': 'jstilia',
  'fingerprint': 'SHA256:cMNof4c6cA/txrP2EeXZfkTA9YjF+vKB4MyGyCfYW6A'}]

In [37]:

Activity

  1. stiliajohny commented on Mar 21, 2022

    @stiliajohny
    Author

    @alejandrojnm perhaps you have seen that before ?

  2. alejandrojnm commented on Mar 22, 2022

    @alejandrojnm
    Member

    Yep the python API is out of date, I need to update all the package

  3. stiliajohny commented on Mar 23, 2022

    @stiliajohny
    Author

    is there an estimated timeline?

  4. anirudhp26 commented on Jun 20, 2022

    @anirudhp26

    I am new to open-source and need help to get started with basic level of issues, can anyone hep out?

    Am here from kunal kushwaha's videos

  5. alejandrojnm commented on Jun 21, 2022

    @alejandrojnm
    Member

    You can fork the project, and if you know python you can start updating the lib with the last change in the API of Civo. The API doc is here, after that, you can open a PR and we can start from there.

  6. anirudhp26 commented on Jun 21, 2022

    @anirudhp26

    Thanks for helping me out i'll surely be helpful to you guys

  7. anirudhp26 commented on Jun 21, 2022

    @anirudhp26

    Can i know how can i start updating the library, and what do i need to update @alejandrojnm

  8. tanmaymunjal commented on Apr 1, 2023

    @tanmaymunjal
    Contributor

    Hey @alejandrojnm , was looking through the API docs of civo and the python code, but I could not find any /templates endpoints on the website,https://www.civo.com/api, the closest I got is https://www.civo.com/api/disk-images, Are the /templates endpoint depreciated or am I missing something? If they are depreciated, I will send in a PR to maybe update the client

  9. alejandrojnm commented on Apr 1, 2023

    @alejandrojnm
    Member

    Yea this lib is out of date, is in my roadmap updated, but is not a P1 right now, sorry for this inconvenience, I will try to move this to my priority task list

  10. tanmaymunjal commented on Apr 1, 2023

    @tanmaymunjal
    Contributor

    No issues @alejandrojnm did send you a PR depreciating some functionality and adding the disk images functionality. Will probably read the rest of the files and see if I can contribute anywhere else.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions