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
42
company/main.py
Normal file
42
company/main.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
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 = HOST + 'api/companies/'+idComp+'/shares'
|
||||
r = requests.get(url)
|
||||
return r.json()
|
||||
|
||||
"""Création d'une action par une entreprise
|
||||
input :
|
||||
- idComp : identifiant de l'entreprise
|
||||
- price : prix de l'action sur le marché
|
||||
"""
|
||||
def newShare(idComp, price):
|
||||
url = HOST + 'api/shares/emmit'
|
||||
obj={'id':idComp,'price':price}
|
||||
r = requests.post(url, json=obj)
|
||||
return r.json()
|
||||
|
||||
"""Affichage des informations d'une enteprise
|
||||
input :
|
||||
- idComp : identifiant de l'entreprise
|
||||
"""
|
||||
def showInfoComp(idComp):
|
||||
url = HOST + 'api/companies/'+idComp
|
||||
r=requests.get(url)
|
||||
return r.json()
|
||||
|
||||
"""Affichage les enteprises """
|
||||
def showComp():
|
||||
url = HOST + 'api/companies/'
|
||||
r=requests.get(url)
|
||||
return r.json()
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue