Apertus
  • Documentation
  • Introduction
    • Definitions
      • Coordinate systems
      • Primitives
    • Features
      • Basic
        • Nodes
        • Light sources
        • Geometries
        • Primitives
        • Texts
      • Environment simulation
        • Water
        • Sky
        • Terrain
      • Browser
      • UI technologies
        • HTML UI
        • Presentation
        • Gallery
      • PointCloud
      • 360
        • 360 Images
        • 360 Videos
      • 3D Model Formats
      • Scene Sharing
        • Multiplayer
      • Video and Voice Chat
      • Hand Tarcking
        • Leap Motion
      • Head Tracking
        • Fob
      • Displays
        • Multi Display
        • Cave System
        • HMDs
      • Industry
        • IoT, and Sensors
        • Robot monitoring
        • Robot calibration
  • Developers
    • Development Cycle
    • Architecture
      • Project folders
      • Configuration ecosystem
    • API
      • C++ API
      • JavaScript API
      • HTTP REST API
    • Getting Started
      • Creating a plugin
      • Creating a sample
  • Contribute
    • Report a Bug
    • Suggest a Feature
  • Tutorial - How to visualize CAD models in VR
    • Introduction
    • Import CAD Models
    • Convert CAD Models
    • Create Low-poly from CAD Models
    • Create Photorealistic CAD Models
  • Plugins - Photorealistic Render
  • Plugins - Physics
  • Tutorial - How to visualize Tensorflow training in VR
  • Tutorial - Virtual Learning Factory Toolkit Gamification
  • Overview
    • Introduction
    • Architecture
    • Use Cases
  • Installation
    • Windows
    • Android
      • How to use
      • Writing an application
    • MacOS
  • Build
    • Windows
      • How to build the source on Windows
    • Android
    • MacOS
  • Plugins on Windows
    • Photorealistic Render
      • How to use
      • How to configure
      • Features
      • Sample
    • Physics
      • How to use
      • How to configure
      • Features
      • Samples
      • Demo video
  • Plugins on Android
    • Java Native Interface
      • How to use
      • Extending the API
    • Filament render
      • How to use
      • How to configure
      • Developers
  • Plugins on MacOS
    • Untitled
  • Samples on Windows
    • Deep learning
      • Untitled
      • Use the Fastai-PythorchVR Sample
      • Use the HTTP API
      • Create HTTP Requests from Python
      • Demo video
    • Virtual Learning Factory Toolkit Gamification
      • Installation
      • Lobby - User Interface
      • Local - User Interface
      • Student - User Interface
      • Teacher - User Interface
      • VLFT Gamification Session
      • VR Mode
  • Virtual Learning Factory Application
    • Installation on Windows
    • Installation on Apple
    • Lobby
    • Single Player
    • Multi Player - Student
    • Multi Player - Teacher
Powered by GitBook
On this page
  1. Samples on Windows
  2. Deep learning

Create HTTP Requests from Python

We will learn how to post a simple request from python.

PreviousUse the HTTP APINextDemo video

Last updated 5 years ago

We are going to work in jupyter notebook. If you have python use should have jupyter notebook too. Run a command line in the folder where your .ipynb file is located, and simpply type in 'jupyter notebook'. A webpage automatically should open, with the files listed from the folder you run the command in. Open the .ipynb.

First of all the imports:

  • import requests

  • import json

For a simple request you don't need anything else.

The code you can see above is in a jupyter notebook cell. You can run each individual cell separately.

file_paths2 is a python dictionary, it contains the number of classes: 2, and the file paths in a python list. In this format we can use this data very easily. We create a try, except block because if we succesfully post the message to Apertus, we don't get feedback.

As you can se posting a request is only 1 line: requests.post( url= "where you want to send the data", json="the data"). The data must be in the above form, because it will automatically convert it to json. We add a 3rd parameter timeout, that is the time we wait for the response, if we get a response we print it, and we print the status too.

If you want to send your data to apertus, you must give the IP adress of the pc where it runs, it wait for messages on the 3000 port, so we add it after the IP, and we must define where to send it in Apertus, for that we write ":3000/api/v1/setfastai" after the IP, because we want the setfastai function to get the data.