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
|
import requests
|
||||||
|
|
||||||
|
HOST = "http://localhost:3000/"
|
||||||
|
|
||||||
"""Affichage des actions mises en vente par une entreprise
|
"""Affichage des actions mises en vente par une entreprise
|
||||||
input :
|
input :
|
||||||
- idComp : Identifiant de l'entreprise
|
- idComp : Identifiant de l'entreprise
|
||||||
"""
|
"""
|
||||||
def showShares(idComp):
|
def showShares(idComp):
|
||||||
url = '192.168.200.15/api/companies/'+idComp+'/shares'
|
url = HOST + 'api/companies/'+idComp+'/shares'
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
print(r.text)
|
return r.json()
|
||||||
|
|
||||||
"""Création d'une action par une entreprise
|
"""Création d'une action par une entreprise
|
||||||
input :
|
input :
|
||||||
|
@ -15,22 +17,26 @@ def showShares(idComp):
|
||||||
- price : prix de l'action sur le marché
|
- price : prix de l'action sur le marché
|
||||||
"""
|
"""
|
||||||
def newShare(idComp, price):
|
def newShare(idComp, price):
|
||||||
url = '192.168.200.15/api/shares/emmit'
|
url = HOST + 'api/shares/emmit'
|
||||||
obj={'id':idComp,'price':price}
|
obj={'id':idComp,'price':price}
|
||||||
r = requests.post(url, json=obj)
|
r = requests.post(url, json=obj)
|
||||||
print(r.text)
|
return r.json()
|
||||||
|
|
||||||
"""Affichage des informations d'une enteprise
|
"""Affichage des informations d'une enteprise
|
||||||
input :
|
input :
|
||||||
- idComp : identifiant de l'entreprise
|
- idComp : identifiant de l'entreprise
|
||||||
"""
|
"""
|
||||||
def showInfoComp(idComp):
|
def showInfoComp(idComp):
|
||||||
url='192.168.200.15/api/companies/'+idComp
|
url = HOST + 'api/companies/'+idComp
|
||||||
r=requests.get(url)
|
r=requests.get(url)
|
||||||
print(r.text)
|
return r.json()
|
||||||
|
|
||||||
"""Affichage les enteprises """
|
"""Affichage les enteprises """
|
||||||
def showComp():
|
def showComp():
|
||||||
url='192.168.200.15/api/companies/'
|
url = HOST + 'api/companies/'
|
||||||
r=requests.get(url)
|
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
|
import requests
|
||||||
|
|
||||||
|
HOST = "http://localhost:3000/"
|
||||||
|
|
||||||
"""Achat d'une action par un actionnaire à une entreprise
|
"""Achat d'une action par un actionnaire à une entreprise
|
||||||
input :
|
input :
|
||||||
- idBuyer : identifiant de l'actionnaire
|
- idBuyer : identifiant de l'actionnaire
|
||||||
- idShare : identifiant de l'action
|
- idShare : identifiant de l'action
|
||||||
"""
|
"""
|
||||||
def buy(idBuyer, idShare):
|
def buyShare(idBuyer, idShare):
|
||||||
url = '192.168.200.15/api/shares/buy'
|
url = HOST + 'api/shares/buy'
|
||||||
obj={'id':idBuyer,'share_id':idShare}
|
obj={'id':idBuyer,'share_id':idShare}
|
||||||
r = requests.post(url, json=obj)
|
r = requests.post(url, json=obj)
|
||||||
print(r.text)
|
return r.json()
|
||||||
|
|
||||||
"""Affichage les actions possédées par un actionnaire
|
"""Affichage les actions possédées par un actionnaire
|
||||||
input :
|
input :
|
||||||
- idBuyer : identifiant de l'actionnaire
|
- idBuyer : identifiant de l'actionnaire
|
||||||
"""
|
"""
|
||||||
def showSharesOf(idBuyer):
|
def getSharesOf(idBuyer):
|
||||||
url = '192.168.200.15/api/shareholders/'+idBuyer+'/shares'
|
url = HOST + 'api/shareholders/'+idBuyer+'/shares'
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
print(r.text)
|
return r.json()
|
||||||
|
|
||||||
"""Affichage les informations d'une actions
|
"""Affichage les informations d'une actions
|
||||||
input :
|
input :
|
||||||
- idShare : identifiant de l'action
|
- idShare : identifiant de l'action
|
||||||
"""
|
"""
|
||||||
def showShare(idShare):
|
def getShare(idShare):
|
||||||
url = '192.168.200.15/api/shares/'+idShare
|
url = HOST + 'api/shares/'+idShare
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
print(r.text)
|
return r.json()
|
||||||
|
|
||||||
"""Affichage les actions en circulation sur le marché (possédées ou en vente) """
|
"""Affichage les actions en circulation sur le marché (possédées ou en vente) """
|
||||||
def showAllShares():
|
def getAllShares():
|
||||||
url = '192.168.200.15/api/shares'
|
url = HOST + 'api/shares'
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
print(r.text)
|
return r.json()
|
||||||
|
|
||||||
"""Affichage les informations sur un actionnaire
|
"""Affichage les informations sur un actionnaire
|
||||||
input :
|
input :
|
||||||
- idBuyer : identifiant de l'actionnaire
|
- idBuyer : identifiant de l'actionnaire
|
||||||
"""
|
"""
|
||||||
def showInfoBuyer(idBuyer):
|
def getInfoBuyer(idBuyer):
|
||||||
url='192.168.200.15/api/shareholders/'+idBuyer
|
url = HOST + 'api/shareholders/'+idBuyer
|
||||||
r=requests.get(url)
|
r=requests.get(url)
|
||||||
print(r.text)
|
return r.json()
|
||||||
|
|
||||||
"""Affichage tous les actionnaires """
|
"""Affichage tous les actionnaires """
|
||||||
def showAllBuyers():
|
def getAllBuyers():
|
||||||
url='192.168.200.15/api/shareholders/'
|
url = HOST + 'api/shareholders/'
|
||||||
r=requests.get(url)
|
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