Code Monkey home page Code Monkey logo

py-shortcut's People

Contributors

paulera avatar

Watchers

 avatar

Forkers

reece

py-shortcut's Issues

Trailing in host causes {"message":"Page not Found"}

Configuration defaults to host = 'https://api.app.shortcut.com/'. The url used in the request becomes https://api.app.shortcut.com//api/v3/... (with double /), which results in an error {"message":"Page not Found"}. This error can be reproduced with curl. rstrip("/") on the host fixes the error.

$ curl -s -X GET   -H "Content-Type: application/json"   -H "Shortcut-Token: $SHORTCUT_API_TOKEN"    -L    'https://api.app.shortcut.com/api/v3/iterations'
[{"app_url":"https:\/\/app.shortcut.com\/myome\/iteration\/116","entity_type":"iteration","labels":[],"mention_ids":[],"member_mention_ids":[],"name":"Sprint 6","label_ids":[],"updated_at":"2022-05-27T00:20:01Z","group_mention_ids":[],"end_date":"2022-06-17","follower_ids":[],"group_ids":[],"start_date":"2022-06-06","status":"unstarted","id":116,"stats":{"num_points_done":0,"num_related_documents":0,"num_stories_unstarted":0,"num_points_started":0,"num_points_unstarted":0,"num_stories_started":1,"num_stories_unestimated":1,"num_points":0,"num_stories_done":0},"created_at":"2022-05-27T00:20:01Z"}]

$ curl -s -X GET   -H "Content-Type: application/json"   -H "Shortcut-Token: $SHORTCUT_API_TOKEN"    -L    'https://api.app.shortcut.com//api/v3/iterations'
{"message":"Page not Found"}

In py_shortcut, I work around this issue with:

    configuration = py_shortcut.Configuration()
    configuration.api_key['Shortcut-Token'] = os.environ["SHORTCUT_API_TOKEN"]
    configuration.host = configuration.host.rstrip("/")
    sc = py_shortcut.DefaultApi(py_shortcut.ApiClient(configuration))
    sc.get_epic(108) # for example

ValueError: Invalid value for ..., must not be `None`

I am able to make requests to shortcut, but deserialization fails for all models that I've tried. For example:

>>> import os, py_shortcut
>>> configuration = py_shortcut.Configuration()
>>> configuration.api_key['Shortcut-Token'] = os.environ["SHORTCUT_API_TOKEN"]
>>> configuration.debug = True
>>> sc = py_shortcut.DefaultApi(py_shortcut.ApiClient(configuration))
>>> sc.list_epics({})
⋮
File ~/projects/reece/github-to-jira/py-shortcut/py_shortcut/models/epic_stats.py:238, in EpicStats.last_story_update(self, last_story_update)
    230 """Sets the last_story_update of this EpicStats.
    231 
    232 The date of the last update of a Story in this Epic.  # noqa: E501
   (...)
    235 :type: datetime
    236 """
    237 if last_story_update is None:
--> 238     raise ValueError("Invalid value for `last_story_update`, must not be `None`")  # noqa: E501
    240 self._last_story_update = last_story_update

ValueError: Invalid value for `last_story_update`, must not be `None`

I'm not able to make any endpoints work. Given that these models are generated, it smells like there's an assumption that the properties are not nullable when at least some of them should be. I don't know how to systematically fix this code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.