Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
How to access an array from a javascript file in a python file

Im building a Spotify application with javascript and react, Ive managed to get a Spotify user's playlists and I have the user select two of those playlists which get put into two different arrays.

var playlist1 = [];
var playlist2 = [];

Inside these arrays there contains all the Spotify playlist data like its id, uri, tracks, etc. What Im trying to do is access these arrays in my python file and apply a recommendation algrotihms to create a playlist based on those two playlists. How would I go about accessesing these arrays in python? Thanks for any help :)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There are two main ways of doing something like this (fairly) easy.

  1. All local:

If you want your app to stay local, just use text files to handle the data. A nice format that both languages can interpret is JSON. So, in your JS, write the data to a text file and then read that textfile in Python.

Above does not really makes sense when using react, since it is really web based. so I would recommend step 2:

  1. Client-server model:

Since you are using React, it is logical to build a client-server model where you use a REST-API (or socket etc.) to send and receive the data to both programs. Then, you can just send the data in JSON format by calling a POST to the rest-api that is hosted by your Python application with the JSON array containing the spotify information.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!