
How to run PHP with Python using a RESTful API
by bernt & torsten
During development, I set up a virtual environment, here is how I did that.
virtualenv
If you are on Mac OS X or Linux, chances are that one of the following two commands will work for you:
$ sudo easy_install virtualenv
or even better:
$ sudo pip install virtualenv
Once you have virtualenv installed, just fire up a shell and create your own environment. I usually create a project folder and a venv folder within:
$ mkdir myproject
$ cd myproject
$ virtualenv venv
New python executable in venv/bin/python
Installing distribute…………done.
Now, whenever you want to work on a project, you only have to activate the corresponding environment. On OS X and Linux, do the following:
$ . venv/bin/activate
If you are a Windows user, the following command is for you:
$ venv\scripts\activate
Either way, you should now be using your virtualenv (notice how the prompt of your shell has changed to show the active environment).
Now you can just enter the following command to get Flask activated in your virtualenv:
$ pip install Flask
A few seconds later and you are good to go.
As I’m going to use the Luminoso Python client, I need to install it
$ pip install luminoso_api
Now it is time to write the rest server in python
Run the rest-server
$ python rest-server.py &
You can test it
curl -X GET http://127.0.0.1:5000/api/v1.0/test
or
http://localhost:5000/api/v1.0/test
Now time to send a test message to Luminoso
curl -H “Content-type: application/json” -X POST http://127.0.0.1:5000/api/v1.0/luminoso -d ‘{“message”:”test”}’

Tech Disillusionment
For four decades, I have worked in the tech industry. I started in the 1980s when computing...

A Poem: The Consultant's Message
On a Friday, cold and gray,
The message came, sharp as steel,
Not from those we...

Using AI to Plan Wall Repair and Gutter Installation
In this article, I will share my experience using AI to plan the work required to fix a wall...