与ProHosting24内部api通信。
prohosting24api的Python项目详细描述
Python ProHosting24 API
这是一个非官方项目!
安装
从pip安装
python3 -m pip install --upgrade prohosting24api --user
手动安装
^{pr2}$如何使用
打开浏览器并转到https://prohosting24.de/cp/,名为“ph24\u sessionid”的Cookie包含sessionid。在
fromprohosting24importApiapi=Api("You'r SessionID")
登录
fromprohosting24importApi,loginapi=login("youremail@email.com","TypeInYourPassword")type(api)==Api
如果要保存api,必须保存api.sessionid_authentication
。在
具有对象引用的函数
以@model_target(Model)
开头的函数是需要对象引用的函数。
ref
参数需要模型或模型的整数id(在某些情况下,将请求模型)。
类型提示将帮助您查看参数类型,例如Union[VServer, int]
。
如果model_target
具有属性get_model
,则在您交出整数id时将请求模型。
ref
属性的类型为ModelReference
。在
服务器
服务器型号:
classVServer(ProHosting24Model):expire_at:datetimedelete_at:datetimeserviceid:intstatus:strid:intnodeid:intuserid:intcores:intmemory:intdisk:intproxmoxid:strbackupslots:intbackuphour:intpacket:intimageid:intprice:floatdiscount:strcreated_on:datetimeip:intdaysleft:intuptime:inttimeleft:int
获取一个VServer
vserver=api.get_vserver(id_of_vserver)type(vserver)==VServer启动/关闭
fromtimeimportsleepvserver=api.get_vserver(id_of_vserver)api.shutdown_server(vserver)sleep(10)api.start_server(vserver)sleep(10)api.stop_server(vserver)# stop means hard stop (not shutdown)
支持系统
型号:
classSupportTicket(ProHosting24Model):"""Basic informations about a ticket."""created_on:datetimeid:intlast_answer:intserviceid:intstatus:inttitle:struserid:intclassSupportAnswer(ProHosting24Model):"""A answer to a ticket."""created_on:datetimeextern:intid:intmitarbeiter:intvorname:strnachname:strtext:struserid:intclassInspectedSupportTicket(SupportTicket):"""A support ticket with informations and answers."""answers:List[SupportAnswer]=[]
获得自己的支持票
tickets=api.get_own_support_tickets()type(tickets)==List[SupportTicket]
检查支持票
ticket=api.inspect_support_ticket(ticket_id)type(ticket)==InspectedSupportTicket
- 项目
标签: