Code Monkey home page Code Monkey logo

learning-content-tools's People

Contributors

frankharkins avatar planetf1 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

planetf1

learning-content-tools's Issues

Fails to publish to production

Attempting to publish to production results in:

requests.exceptions.MissingSchema: Invalid URL 'learning-api.quantum-computing.ibm.com/items/lessons/cb7f673b-abf4-4c61-bdfc-4e1b40ff5d50?fields[]=translations.id,translations.languages_code': No scheme supplied. Perhaps you meant https://learning-api.quantum-computing.ibm.com/items/lessons/cb7f673b-abf4-4c61-bdfc-4e1b40ff5d50?fields[]=translations.id,translations.languages_code?

I'll test a fix & can create a PR - the site needs updating.

Improve environment selection

  • Change environment variable name to LEARNING_API_ENVIRONMENT
  • Ask user for environment if not set when using login
  • Raise error if not set when using env var api token

Neaten `push` method

This is quite long and a bit messy โ€“ try to refactor to make it easier to read and maintain.

Improve zipping behaviour

  • Put zips into system temp folder (1a75fa1)
  • Clean up on exit (clean or error) (f9cb7f2)
  • Correctly exit and report RuntimeError: File size too large, try using force_zip64

Empty lesson id causes upload failure to be reported

For a course I am developing, I have one lesson which I want to publish to 'staging', but am not ready to publish to 'production'

I therefore have a lesson configured in iql.conf.yaml as follows:

  - path: lessons/Quiz
    idStaging: b49f924e-4173-ab7c-81c4-3f6eb0a8d3b0
    idProduction:

In this case, the upload tool will fail with:

โŒ Push Quiz: Finding English translation...
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.11.0/bin/sync-lessons", line 8, in
sys.exit(sync_lessons())
^^^^^^^^^^^^^^
File "/home/travis/virtualenv/python3.11.0/lib/python3.11/site-packages/iql_lesson_sync/init.py", line 55, in sync_lessons
api.push(lesson)
File "/home/travis/virtualenv/python3.11.0/lib/python3.11/site-packages/iql_lesson_sync/upload.py", line 93, in push
raise err
File "/home/travis/virtualenv/python3.11.0/lib/python3.11/site-packages/iql_lesson_sync/upload.py", line 82, in push
web_page = self._push(lesson, _log_fn)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/travis/virtualenv/python3.11.0/lib/python3.11/site-packages/iql_lesson_sync/upload.py", line 123, in _push
response.raise_for_status()
File "/home/travis/virtualenv/python3.11.0/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://learning-api.quantum-computing.ibm.com/items/lessons/None?fields%5B%5D=translations.id,translations.languages_code

It would be useful to treat this as a warning (or successful) since it is performing as the user intends, and
the tool should run to completion.

originally in my case this lesson was mid way through my lesson list, so caused later lessons not to be published. A little reordering means it's easy to workaround.

I can look at a PR once we're past our release...

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.