Giter Site home page Giter Site logo

howtousedbf-from-python's Introduction

How to make a rest service from a dbf with python

#
# VISUAL FOX PRO - CODE
#
DEFINE CLASS Testing AS CUSTOM OLEPUBLIC

    PROCEDURE INIT
        ON ERROR
        SET CONSOLE OFF
        SET NOTIFY OFF
        SET SAFETY OFF
        SET TALK OFF
        SET NOTIFY OFF
    ENDPROC

    FUNCTION get_input_out(input AS STRING) AS STRING
        output = input
        RETURN output
    ENDFUNC

ENDDEFINE
# Instructions: Build the project as single-threaded COM
# Register the library with:
C:/windows/system32/regsvr32.exe [pathToDLL-file]
# Use with (for test)

o = CREATEOBJECTEX("expose-dll.Testing")
? o.get_input_out("Any string")
INSTALL PYTHON 2.7

http://docs.python-guide.org/en/latest/starting/install/win/

(add C:/Python27 to the PATH enviromental variable and C:/Python27/Scripts)

Download the pywin32-220.win32-py2.7.exe from and install it:

https://sourceforge.net/projects/pywin32/files/pywin32/Build%20220/

TEST PYTHON LYBRARY

from win32com.client import Dispatch
oFox = Dispatch("expose-dll.Testing")
# where the file name compiled by VFP is com.dll and the olepublic class is testing.
# in Windows this stuff is not case sensitive.
print oFox.get_input_out("something")
# to close things down..
oFox = None

INSTALL flask

pip install flask
Test de flask and python installation

Create a server.py file and copy:

from flask import Flask

app = Flask(__name__)

@app.route('/', methods=['GET'])
def root():
    return 'HELLO WORLD'

if __name__ == '__main__'    :
    app.run(host='0.0.0.0', debug=True, port=8080)
python server.py

Open the browser and navigate to http://localhost:8080

TEST ALL TOGETHER

from win32com.client import Dispatch
from flask import Flask
oFox = Dispatch("expose-dll.Testing")

app = Flask(__name__)

@app.route('/', methods=['GET'])
def root():
    return oFox.get_input_out("HELLO WORLD BY PASS VISUAL FOX PRO!")

if __name__ == '__main__'    :
    app.run(host='0.0.0.0', debug=True, port=8080)

howtousedbf-from-python's People

Contributors

alejandropaciotti avatar

Watchers

James Cloos avatar  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.