generated from lucien/api-template
Added client scripts
This commit is contained in:
parent
7d0406ef6e
commit
c57a2511d8
14 changed files with 87 additions and 0 deletions
0
.gitignore → api/.gitignore
vendored
0
.gitignore → api/.gitignore
vendored
0
package-lock.json → api/package-lock.json
generated
0
package-lock.json → api/package-lock.json
generated
51
client/actionnaire.py
Normal file
51
client/actionnaire.py
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
import requests
|
||||||
|
|
||||||
|
"""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'
|
||||||
|
obj={'id':idBuyer,'share_id':idShare}
|
||||||
|
r = requests.post(url, json=obj)
|
||||||
|
print(r.text)
|
||||||
|
|
||||||
|
"""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'
|
||||||
|
r = requests.get(url)
|
||||||
|
print(r.text)
|
||||||
|
|
||||||
|
"""Affichage les informations d'une actions
|
||||||
|
input :
|
||||||
|
- idShare : identifiant de l'action
|
||||||
|
"""
|
||||||
|
def showShare(idShare):
|
||||||
|
url = '192.168.200.15/api/shares/'+idShare
|
||||||
|
r = requests.get(url)
|
||||||
|
print(r.text)
|
||||||
|
|
||||||
|
"""Affichage les actions en circulation sur le marché (possédées ou en vente) """
|
||||||
|
def showAllShares():
|
||||||
|
url = '192.168.200.15/api/shares'
|
||||||
|
r = requests.get(url)
|
||||||
|
print(r.text)
|
||||||
|
|
||||||
|
"""Affichage les informations sur un actionnaire
|
||||||
|
input :
|
||||||
|
- idBuyer : identifiant de l'actionnaire
|
||||||
|
"""
|
||||||
|
def showInfoBuyer(idBuyer):
|
||||||
|
url='192.168.200.15/api/shareholders/'+idBuyer
|
||||||
|
r=requests.get(url)
|
||||||
|
print(r.text)
|
||||||
|
|
||||||
|
"""Affichage tous les actionnaires """
|
||||||
|
def showAllBuyers():
|
||||||
|
url='192.168.200.15/api/shareholders/'
|
||||||
|
r=requests.get(url)
|
||||||
|
print(r.text)
|
36
client/entreprise.py
Normal file
36
client/entreprise.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
import requests
|
||||||
|
|
||||||
|
"""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'
|
||||||
|
r = requests.get(url)
|
||||||
|
print(r.text)
|
||||||
|
|
||||||
|
"""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 = '192.168.200.15/api/shares/emmit'
|
||||||
|
obj={'id':idComp,'price':price}
|
||||||
|
r = requests.post(url, json=obj)
|
||||||
|
print(r.text)
|
||||||
|
|
||||||
|
"""Affichage des informations d'une enteprise
|
||||||
|
input :
|
||||||
|
- idComp : identifiant de l'entreprise
|
||||||
|
"""
|
||||||
|
def showInfoComp(idComp):
|
||||||
|
url='192.168.200.15/api/companies/'+idComp
|
||||||
|
r=requests.get(url)
|
||||||
|
print(r.text)
|
||||||
|
|
||||||
|
"""Affichage les enteprises """
|
||||||
|
def showComp():
|
||||||
|
url='192.168.200.15/api/companies/'
|
||||||
|
r=requests.get(url)
|
||||||
|
print(r.text)
|
Loading…
Add table
Add a link
Reference in a new issue