generated from lucien/api-template
Fixed client scripts
This commit is contained in:
parent
c57a2511d8
commit
e2d8d04c04
4 changed files with 48 additions and 26 deletions
5
company/Dockerfile
Normal file
5
company/Dockerfile
Normal file
|
@ -0,0 +1,5 @@
|
|||
FROM python:alpine
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
CMD ["python", "-u", "main.py"]
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
import requests
|
||||
|
||||
HOST = "http://localhost:3000/"
|
||||
|
||||
"""Affichage des actions mises en vente par une entreprise
|
||||
input :
|
||||
- idComp : Identifiant de l'entreprise
|
||||
"""
|
||||
def showShares(idComp):
|
||||
url = '192.168.200.15/api/companies/'+idComp+'/shares'
|
||||
url = HOST + 'api/companies/'+idComp+'/shares'
|
||||
r = requests.get(url)
|
||||
print(r.text)
|
||||
return r.json()
|
||||
|
||||
"""Création d'une action par une entreprise
|
||||
input :
|
||||
|
@ -15,22 +17,26 @@ def showShares(idComp):
|
|||
- price : prix de l'action sur le marché
|
||||
"""
|
||||
def newShare(idComp, price):
|
||||
url = '192.168.200.15/api/shares/emmit'
|
||||
url = HOST + 'api/shares/emmit'
|
||||
obj={'id':idComp,'price':price}
|
||||
r = requests.post(url, json=obj)
|
||||
print(r.text)
|
||||
return r.json()
|
||||
|
||||
"""Affichage des informations d'une enteprise
|
||||
input :
|
||||
- idComp : identifiant de l'entreprise
|
||||
"""
|
||||
def showInfoComp(idComp):
|
||||
url='192.168.200.15/api/companies/'+idComp
|
||||
url = HOST + 'api/companies/'+idComp
|
||||
r=requests.get(url)
|
||||
print(r.text)
|
||||
return r.json()
|
||||
|
||||
"""Affichage les enteprises """
|
||||
def showComp():
|
||||
url='192.168.200.15/api/companies/'
|
||||
url = HOST + 'api/companies/'
|
||||
r=requests.get(url)
|
||||
print(r.text)
|
||||
return r.json()
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
5
shareholder/Dockerfile
Normal file
5
shareholder/Dockerfile
Normal file
|
@ -0,0 +1,5 @@
|
|||
FROM python:alpine
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
CMD ["python", "-u", "main.py"]
|
||||
|
|
@ -1,51 +1,57 @@
|
|||
import requests
|
||||
|
||||
HOST = "http://localhost:3000/"
|
||||
|
||||
"""Achat d'une action par un actionnaire à une entreprise
|
||||
input :
|
||||
- idBuyer : identifiant de l'actionnaire
|
||||
- idShare : identifiant de l'action
|
||||
"""
|
||||
def buy(idBuyer, idShare):
|
||||
url = '192.168.200.15/api/shares/buy'
|
||||
def buyShare(idBuyer, idShare):
|
||||
url = HOST + 'api/shares/buy'
|
||||
obj={'id':idBuyer,'share_id':idShare}
|
||||
r = requests.post(url, json=obj)
|
||||
print(r.text)
|
||||
return r.json()
|
||||
|
||||
"""Affichage les actions possédées par un actionnaire
|
||||
input :
|
||||
- idBuyer : identifiant de l'actionnaire
|
||||
"""
|
||||
def showSharesOf(idBuyer):
|
||||
url = '192.168.200.15/api/shareholders/'+idBuyer+'/shares'
|
||||
def getSharesOf(idBuyer):
|
||||
url = HOST + 'api/shareholders/'+idBuyer+'/shares'
|
||||
r = requests.get(url)
|
||||
print(r.text)
|
||||
return r.json()
|
||||
|
||||
"""Affichage les informations d'une actions
|
||||
input :
|
||||
- idShare : identifiant de l'action
|
||||
"""
|
||||
def showShare(idShare):
|
||||
url = '192.168.200.15/api/shares/'+idShare
|
||||
def getShare(idShare):
|
||||
url = HOST + 'api/shares/'+idShare
|
||||
r = requests.get(url)
|
||||
print(r.text)
|
||||
return r.json()
|
||||
|
||||
"""Affichage les actions en circulation sur le marché (possédées ou en vente) """
|
||||
def showAllShares():
|
||||
url = '192.168.200.15/api/shares'
|
||||
def getAllShares():
|
||||
url = HOST + 'api/shares'
|
||||
r = requests.get(url)
|
||||
print(r.text)
|
||||
return r.json()
|
||||
|
||||
"""Affichage les informations sur un actionnaire
|
||||
input :
|
||||
- idBuyer : identifiant de l'actionnaire
|
||||
"""
|
||||
def showInfoBuyer(idBuyer):
|
||||
url='192.168.200.15/api/shareholders/'+idBuyer
|
||||
def getInfoBuyer(idBuyer):
|
||||
url = HOST + 'api/shareholders/'+idBuyer
|
||||
r=requests.get(url)
|
||||
print(r.text)
|
||||
return r.json()
|
||||
|
||||
"""Affichage tous les actionnaires """
|
||||
def showAllBuyers():
|
||||
url='192.168.200.15/api/shareholders/'
|
||||
def getAllBuyers():
|
||||
url = HOST + 'api/shareholders/'
|
||||
r=requests.get(url)
|
||||
print(r.text)
|
||||
return r.json()
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue