Giter Site home page Giter Site logo

xml_data_exporter's Introduction

XML Data Exporter

This is a Flask application for parsing data about available products from XML file.

First, the application downloads the latest data in ZIP archive file, which is then extracted and the data are parsed from the extracted XML file. If the ZIP file is already available, the application will use the data from it. Latest ZIP file can be manually updated using an endpoint.

User can choose from four options, what he desires to return:

1 - Count of all products
2 - List of all products
3 - List of product with spare parts
4 - Download latest data

Products structure

Product names are stored in the items node in the root of the XML file. Some products have also available spare parts in parts node where categoryId attribute have value of 1 (spare parts category).

REST API endpoints

The application offers basic REST API for accessing the data. Index page has a signpost to all available endpoints.

The endpoints are listed below (all endpoints are using the HTTP GET method):

/ - Index page with a signpost to all endpoints
/products/1 - Returns count of all products
/products/2 - Returns list of all products
/products/3 - Returns list of products with spare parts
/products/4 - Downloads latest data

Downloading the latest data is made using GET endpoint, for ease of testing. Correct HTTP method should be PUT.

Docker

The application can be started using Docker command docker-compose up.

Tests

The application has unit tests for all three data endpoints. Tests can be run using pytest command pytest test_app.py.

xml_data_exporter's People

Contributors

majkluss avatar

Watchers

 avatar

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.