Best Python code snippet using robotframework-ioslibrary_python
create_controllers_views.py
Source:create_controllers_views.py
1# create_controllers.py23import os4 5#controller = os.mkdir('controller')67if not os.path.exists('../controllers'):8 os.makedirs('../controllers')9 os.makedirs('../views')10 11userinput = input('Please Enter Filename!: ')1213os.makedirs('../views/'+userinput)1415ext = ".php"1617filename = userinput+ext1819uclassinput = input('Please Enter Class name!: ')2021classinput = uclassinput.title()2223f = open('../controllers/'+filename,'w')24g = open('../views/'+userinput+'/index.php','w')2526if not os.path.exists('../views/templates'):27 os.makedirs('../views/templates')2829h = open('../views/templates/header.php','w')30i = open('../views/templates/footer.php','w') 3132message = """<?php3334 class """ + classinput + """ extends Controller{35 36 public function index(){3738 $data['title'] = '"""+classinput+"""';39 40 $this->view('templates/header', $data);41 $this->view('"""+userinput+"""/index', $data);42 $this->view('templates/footer'); 4344 }45 46 public function User(){47 48 $data['title'] = "User";4950 $this->view('templates/header', $data);51 $this->view('users/index', $data);52 $this->view('templates/footer'); 53 54 } 5556 public function dashboard(){57 58 $logged = Session::get('loggedIn');59 60 if ($logged == false) {61 62 Session::destroy();63 header('location: ' . BASEURL . 'dashboard/login');64 exit;65 66 }67 68 $uid = Session::get('uid');69 70 $data['users'] = $this->model('Users_model')->getAllData($uid);7172 $data['title'] = "User";7374 $this->view('templates/header', $data);75 $this->view('dashboard/index', $data);76 $this->view('templates/footer'); 77 78 }79 80 public function resetPass(){81 82 $password = $_POST['npassword'];83 $email = $_POST['emailpass'];84 85 $apassword = Openssl::encrypt($password,$email);8687 if($this->model('Users_model')->checkAccPassword($_POST) > 0 ){ 8889 $change = $this->model('Users_model')->changeAccPassword($_POST, $apassword);9091 if($change > 0 ){92 93 $to = $email;94 $subject = "MVC Crud Password Changed";95 $message = "96 <html>97 <head>98 <title>MVC Crud Password Changed</title>99 </head>100 <body>101 <p>Hai '$username'</p>102 <p><h2>Acc Info</h2></p>103 <p>Login ID: '$username'</p>104 <p>Your New Password: '$password'</p>105 <p>106 Thank you,<br >107 MVC Crud <br >108 Hotline : 012-3456789109 </p>110 </body>111 </html>112 ";113 // Always set content-type when sending HTML email114 $headers = "MIME-Version: 1.0" . "\r\n";115 $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";116 // More headers117 $headers .= 'From: <admin@progse.com>' . "\r\n";118 $headers .= 'Cc: myboss@example.com' . "\r\n";119 mail($to,$subject,$message,$headers); 120 121 Session::destroy();122 Session::setFlash(' Password Change ', 'Succesfully', 'success'); 123 header('Location: ' . BASEURL . 'Users/login');124 exit;125126 }else{127128 Session::setFlash(' Failed ', 'to Change Password', 'danger');129 header('Location: ' . BASEURL . 'Users');130 exit;131132 }133134 }else{135136 Session::setFlash(' Current ', 'Password Invalid', 'danger');137 header('Location: ' . BASEURL . 'Users');138 exit; 139140 }141 142 }143 144145 public function login(){146147 $data['title'] = "Login";148149 $this->view('templates/header', $data);150 $this->view('dashboard/login', $data);151 $this->view('templates/footer');152153 }154155156 public function loginCheck(){157158 $data['title'] = "Login Check";159160 $logid = $_POST['logid'];161162 $password = $_POST['password'];163 164 if($this->model('Users_model')->loginCheck($_POST) > 0){165 166 $data['users'] = $this->model('Users_model')->getUserData($logid, $password);167 168 $uid = $data['users']['id'];169 170 Session::set('uid', $uid);171 Session::set('loggedIn', true);172173 Session::setFlash(' Succesfully ', 'Logged in', 'success');174 header('Location: ' . BASEURL . 'dashboard');175 exit;176177 }else{178 179 Session::setFlash(' Password maybe Wrong or your Users is not activate ', 'please check your email', 'danger');180 181 ?>182 <script>183 alert("Failed");184 </script>185 186 <?php187 header('Location: ' . BASEURL . 'dashboard/login');188 exit;189 }190191 }192193194 public function create(){195196 $pics = BASEURL . "uploads/" . $_FILES["file"]["name"];197198 $username = $_POST['username'];199 $password = $_POST['password'];200 $email = $_POST['email']; 201 $contact = $_POST['contact'];202 203 $apassword = Openssl::encrypt($password,$email);204205 if($this->model('Users_model')->createAcc($_POST, $pics, $apassword) > 0){206 207 208 $url = 'https://api.twilio.com/2010-04-01/Users/+yourtoke+/Messages.json'; 209 210 $from = "+14792529356";211212 $to = "+6".$contact;213 214 $root = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';215 $activate = $root.ACTVURL.$username."/".$password; 216217 $body = $activate;218219 $id = "AC4244a6a3efbb7ac8da72613fca003bf6";220221 $token = "f10db1f05c42bc6f8074175c88f487da";222223 $data = array (224225 'From' => $from,226 'To' => $to,227 'Body' => $body228 229 );230 231 $post = http_build_query($data);232 $x = curl_init($url);233 curl_setopt($x, CURLOPT_POST, true);234 curl_setopt($x, CURLOPT_RETURNTRANSFER, true);235 curl_setopt($x, CURLOPT_USERPWD, "$id:$token");236 curl_setopt($x, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);237 curl_setopt($x, CURLOPT_POSTFIELDS, $post);238239 var_dump($post);240 $y = curl_exec($x);241 var_dump($y);242 curl_close($x);243244245 $root = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';246 $activate = $root.ACTVURL.$username."/".$password;247 $to = $email;248 $subject = "MVC Crud Registration";249 $message = "250 <html>251 <head>252 <title>MVC Crud Registration</title>253 </head>254 <body>255 <p>Hai '$username'</p>256 <p><h2>Acc Info</h2></p>257 <p>Activation URL : '$activate'</p>258 <p>Login ID: '$username'</p>259 <p>Password: '$password'</p>260 <p>261 Thank you,<br >262 MVC Crud <br >263 Hotline : 012-3456789264 </p>265 </body>266 </html>267 ";268 // Always set content-type when sending HTML email269 $headers = "MIME-Version: 1.0" . "\r\n";270 $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";271 // More headers272 $headers .= 'From: <admin@progse.com>' . "\r\n";273 $headers .= 'Cc: myboss@example.com' . "\r\n";274 mail($to,$subject,$message,$headers); 275 276 Session::setFlash(' Succesfully ', 'Added', 'success');277 header('Location: ' . BASEURL . 'Users/login');278 exit;279280 }else{281282 Session::setFlash(' Failed ', 'to Add', 'danger');283 header('Location: ' . BASEURL . 'Users/login');284 exit;285286 } 287288 }289290 291 public function email_activation($logid, $password){ 292 293 $data['Users'] = $this->model('Users_model')->getAccData($logid, $password);294 295 $uid = $data['Users']['id'];296 297 if($this->model('Users_model')->editStatus($uid) > 0 ){298 299 ?>300 301 <script type="text/javascript">302 303 alert("Akaun anda telah di Aktifkan!");304305 window.close();306 307 </script>308 309 <?php310311 }else{312 313 ?>314 315 <script type="text/javascript">316 317 alert("Akaun anda gagal di Aktifkan!");318319 window.close();320 321 </script>322 323 <?php324325 } 326 327 }328329330 public function logout(){331 332 Session::destroy();333 header('location: ' . BASEURL . 'Users/login');334 exit;335336 }337338339 public function editAcc(){340341 //echo $_POST['id'];342343 echo json_encode($this->model('Users_model')->editAccData($_POST['id']));344345 } 346347348 public function editUsers(){349 350 //echo $_POST['id']; 351352 $username = $_POST['username'];353 $contact = $_POST['contact'];354 $email = $_POST['email']; 355 356 if($this->model('Users_model')->editUsersData($_POST) > 0 ){357 358 $to = $email;359 $subject = "MVC Crud Users Modified";360 $message = "361 <html>362 <head>363 <title>MVC Crud Users Modified</title>364 </head>365 <body>366 <p>Hai '$username'</p>367 <p><h2>Acc Info</h2></p>368 <p>Login ID: '$username'</p>369 <p>Contact Number: '$contact'</p>370 <p>Email: '$email'</p>371 <p>372 Thank you,<br >373 MVC Crud <br >374 Hotline : 012-3456789375 </p>376 </body>377 </html>378 ";379 // Always set content-type when sending HTML email380 $headers = "MIME-Version: 1.0" . "\r\n";381 $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";382 // More headers383 $headers .= 'From: <admin@progse.com>' . "\r\n";384 $headers .= 'Cc: myboss@example.com' . "\r\n";385 mail($to,$subject,$message,$headers); 386 387 Session::setFlash(' Users Edited ', 'Succesfully', 'success');388 header('Location: ' . BASEURL . 'Users');389 exit;390391 }else{392 393 Session::setFlash(' Failed ', 'to Edit Users', 'danger');394 header('Location: ' . BASEURL . 'Users');395 exit;396397 }398399 }400401402403 public function editPic(){404405 $pics = BASEURL . "uploads/" . $_FILES["file"]["name"];406407 if($this->model('Users_model')->changeAccPic($_POST, $pics) > 0 ){408409 Session::setFlash(' Picture Change ', 'Succesfully', 'success');410 header('Location: ' . BASEURL . 'Users');411 exit;412413 }else{414415 Session::setFlash(' Failed ', 'to Change Picture', 'danger');416 header('Location: ' . BASEURL . 'Users');417 exit;418419 } 420421 }422423424 public function changePassword(){425426 $username = $_POST['userpass'];427 $password = $_POST['npassword'];428 $email = $_POST['emailpass'];429 430 $apassword = Openssl::encrypt($password,$email);431432 if($this->model('Users_model')->checkAccPassword($_POST) > 0 ){ 433434 $change = $this->model('Users_model')->changeAccPassword($_POST, $apassword);435436 if($change > 0 ){437 438 $to = $email;439 $subject = "MVC Crud Password Changed";440 $message = "441 <html>442 <head>443 <title>MVC Crud Password Changed</title>444 </head>445 <body>446 <p>Hai '$username'</p>447 <p><h2>Acc Info</h2></p>448 <p>Login ID: '$username'</p>449 <p>Your New Password: '$password'</p>450 <p>451 Thank you,<br >452 MVC Crud <br >453 Hotline : 012-3456789454 </p>455 </body>456 </html>457 ";458 // Always set content-type when sending HTML email459 $headers = "MIME-Version: 1.0" . "\r\n";460 $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";461 // More headers462 $headers .= 'From: <admin@progse.com>' . "\r\n";463 $headers .= 'Cc: myboss@example.com' . "\r\n";464 mail($to,$subject,$message,$headers); 465 466 Session::destroy();467 Session::setFlash(' Password Change ', 'Succesfully', 'success'); 468 header('Location: ' . BASEURL . 'Users/login');469 exit;470471 }else{472473 Session::setFlash(' Failed ', 'to Change Password', 'danger');474 header('Location: ' . BASEURL . 'Users');475 exit;476477 }478479 }else{480481 Session::setFlash(' Current ', 'Password Invalid', 'danger');482 header('Location: ' . BASEURL . 'Users');483 exit; 484485 } 486487 }488 489 490 public function passcheck(){491 492 $email = $_POST['email'];493 494 if($this->model('Users_model')->getPass($_POST['email']) > 0 ){ 495496 $data['Users'] = $this->model('Users_model')->getPass($_POST['email']);497 498 $apassword = $data['Users']['apassword'];499 500 $password = Openssl::decrypt($apassword, $email); 501502 if($password != null ){503 504 $to = $email;505 $subject = "MVC Crud Forgot Password";506 $message = "507 <html>508 <head>509 <title>MVC Crud PForgot Password</title>510 </head>511 <body>512 <p>Hai '$username'</p>513 <p><h2>Acc Info</h2></p>514 <p>Login ID: '$username'</p>515 <p>Your Password is: '$password'</p>516 <p>517 Thank you,<br >518 MVC Crud <br >519 Hotline : 012-3456789520 </p>521 </body>522 </html>523 ";524 // Always set content-type when sending HTML email525 $headers = "MIME-Version: 1.0" . "\r\n";526 $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";527 // More headers528 $headers .= 'From: <admin@progse.com>' . "\r\n";529 $headers .= 'Cc: myboss@example.com' . "\r\n";530 mail($to,$subject,$message,$headers); 531 532 Session::setFlash(' Forgot Password Send ', 'Succesfully', 'success'); 533 header('Location: ' . BASEURL . 'Users/forgotpass');534 exit;535536 }else{537538 Session::setFlash(' Failed ', 'to send Password', 'danger');539 header('Location: ' . BASEURL . 'Users/forgotpass');540 exit;541542 }543544 }else{545546 Session::setFlash(' Email ', 'Not Exist', 'danger');547 header('Location: ' . BASEURL . 'Users/forgotpass');548 exit; 549550 } 551 552 }553 554 public function ajaxApi(){555 556 //$data = $_POST['data']; 557 558 $logid = $_POST['logid'];559 560 $password = $_POST['password'];561 562 //$logid = $_SERVER['PHP_AUTH_USER'];563 //$password = $_SERVER['PHP_AUTH_PW'];564 565 566 567 if($this->model('Users_model')->getAccData($logid, $password)){568 569 header("Access-Control-Allow-Origin: *");570 header("Content-Type: application/json; charset=UTF-8");571572 echo json_encode($this->model('Users_model')->getAccData($logid, $password));573 574 }else{575 576 $msg = "Failed!";577 578 echo json_encode($msg);579 }580581 }582583 public function curlApi(){584 585 //$data = $_POST['data']; 586 587 //$logid = $_POST['logid']; 588 //$password = $_POST['password'];589 590 $logid = $_SERVER['PHP_AUTH_USER'];591 $password = $_SERVER['PHP_AUTH_PW'];592 593 594 595 if($this->model('Users_model')->getAccData($logid, $password)){596 597 header("Access-Control-Allow-Origin: *");598 header("Content-Type: application/json; charset=UTF-8");599600 echo json_encode($this->model('Users_model')->getAccData($logid, $password));601 602 }else{603 604 $msg = "Failed!";605 606 echo json_encode($msg);607 }608609 } 610 611 public function detail($id){612613 $data['title'] = '"""+classinput+"""';614 $data['mhs'] = $this->model('"""+classinput+"""_model')->getDataById($id);615 $this->view('templates/header', $data);616 $this->view('"""+userinput+"""/detail', $data);617 $this->view('templates/footer');618619 } 620621 public function added(){622623 if($this->model('"""+classinput+"""_model')->addData($_POST, $_FILES['pics']['name'], $_FILES['pics']['tmp_name']) > 0 ){624 625 Flasher::setFlash(' Added ', 'Succesfully', 'success');626 header('Location: ' . BASEURL . '/"""+userinput+"""');627 exit;628629 }else{630631 Flasher::setFlash(' Added ', 'Failed!', 'danger');632 header('Location: ' . BASEURL . '/"""+userinput+"""');633 exit;634635 }636637 } 638639 public function delete($id){640641 if($this->model('"""+classinput+"""_model')->deleteData($id) > 0){642 Flasher::setFlash(' deleted ', 'Succesfully', 'success');643 header('Location: ' . BASEURL . '/"""+userinput+"""');644 exit;645646 }else{647648 Flasher::setFlash(' delete ', 'Failed', 'danger');649 header('Location: ' . BASEURL . '/"""+userinput+"""');650 exit;651652 }653654 } 655656 public function getedit(){657658 //echo $_POST['id'];659660 echo json_encode($this->model('"""+classinput+"""_model')->getEditData($_POST['id']));661662 }663664 public function edit(){665666 if($this->model('"""+classinput+"""_model')->editData($_POST) > 0 ){667 Flasher::setFlash(' berjaya ', 'di edit', 'success');668 header('Location: ' . BASEURL . '/"""+userinput+"""');669 exit;670671 }else{672673 Flasher::setFlash(' gagal ', 'di edit', 'danger');674 header('Location: ' . BASEURL . '/"""+userinput+"""');675 exit;676677 } 678679 }680681682 public function search(){683684 $data['title'] = '"""+classinput+"""';685 $data['mhs'] = $this->model('"""+classinput+"""_model')->searchData();686 $this->view('templates/header', $data);687 $this->view('"""+userinput+"""/index', $data);688 $this->view('templates/footer'); 689690 } 691 692 public function phpinfo(){ 693694 $data['title'] = 'Defaults';695696 $this->view('defaults/phpinfo', $data);697 }698699 700 }701702"""703704f.write(message)705f.close()706707708content = """<h1>Hello World!</h1>"""709710g.write(content)711g.close()712713header = """<!doctype html>714<html lang="en">715 <head>716 <!-- Required meta tags -->717 <meta charset="utf-8">718 <meta name="viewport" content="width=device-width, initial-scale=1">719720 <!-- Bootstrap CSS -->721 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css" integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I" crossorigin="anonymous">722723 <title>Hello, world!</title>724 </head>725 <body>"""726 727h.write(header)728h.close()729730footer = """ <!-- Optional JavaScript -->731 <!-- Popper.js first, then Bootstrap JS -->732 <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>733 <script src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js" integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/" crossorigin="anonymous"></script>734 </body>735</html>"""736 737i.write(footer)
...
__init__.py
Source:__init__.py
...21 self.order = MerchantOrder(self._client)22 self.common = MerchantCommon(self._client)23 def create(self, product_data):24 """å¢å åå"""25 return self._post(26 'merchant/create',27 data=product_data28 )29 def delete(self, product_id):30 """å é¤åå"""31 return self._post(32 'merchant/del',33 data={34 'product_id': product_id35 }36 )37 def update(self, product_id, product_data):38 """ä¿®æ¹åå"""39 product_data['product_id'] = product_id40 return self._post(41 'merchant/update',42 data=product_data43 )44 def get(self, product_id):45 """æ¥è¯¢åå"""46 return self._post(47 'merchant/get',48 data={49 'product_id': product_id50 }51 )52 def get_by_status(self, status):53 """è·åæå®ç¶æçææåå"""54 return self._post(55 'merchant/getbystatus',56 data={57 'status': status58 }59 )60 def update_product_status(self, product_id, status):61 """ååä¸ä¸æ¶"""62 return self._post(63 'merchant/modproductstatus',64 data={65 'product_id': product_id,66 'status': status67 }68 )69 def get_subcategories(self, cate_id):70 """71 è·åæå®åç±»çææååç±»72 :param cate_id: 大åç±»ID(æ ¹èç¹åç±»id为1)73 :return: è¿åç JSON æ°æ®å
74 """75 return self._post(76 'merchant/category/getsub',77 data={78 'cate_id': cate_id79 }80 )81 def get_category_sku(self, cate_id):82 """83 è·åæå®ååç±»çææSKU84 :param cate_id: ååååç±»ID85 :return: è¿åç JSON æ°æ®å
86 """87 return self._post(88 'merchant/category/getsku',89 data={90 'cate_id': cate_id91 }92 )93 def get_category_property(self, cate_id):94 """95 è·åæå®åç±»çææå±æ§96 :param cate_id: ååååç±»ID97 :return: è¿åç JSON æ°æ®å
98 """99 return self._post(100 'merchant/category/getproperty',101 data={102 'cate_id': cate_id103 }104 )105 def add_stock(self, product_id, sku_info, quantity):106 """107 å¢å åºå108 :param product_id: ååID109 :param sku_info: skuä¿¡æ¯,æ ¼å¼"id1:vid1;id2:vid2",å¦åå为ç»ä¸è§æ ¼ï¼åæ¤å¤èµå¼ä¸ºç©ºå符串å³å¯110 :param quantity: å¢å çåºåæ°é111 :return: è¿åç JSON æ°æ®å
112 """113 return self._post(114 'merchant/stock/add',115 data={116 "product_id": product_id,117 "sku_info": sku_info,118 "quantity": quantity119 }120 )121 def reduce_stock(self, product_id, sku_info, quantity):122 """123 åå°åºå124 :param product_id: ååID125 :param sku_info: skuä¿¡æ¯,æ ¼å¼"id1:vid1;id2:vid2",å¦åå为ç»ä¸è§æ ¼ï¼åæ¤å¤èµå¼ä¸ºç©ºå符串å³å¯126 :param quantity: åå°çåºåæ°é127 :return: è¿åç JSON æ°æ®å
128 """129 return self._post(130 'merchant/stock/reduce',131 data={132 "product_id": product_id,133 "sku_info": sku_info,134 "quantity": quantity135 }136 )137 def add_express(self, product_data):138 """139 å¢å é®è´¹æ¨¡æ¿140 :param product_data: é®è´¹ä¿¡æ¯141 :return: è¿åç JSON æ°æ®å
142 """143 return self._post(144 'merchant/express/add',145 data=product_data146 )147 def del_express(self, template_id):148 """149 å¢å é®è´¹æ¨¡æ¿150 :param template_id: é®è´¹æ¨¡æ¿ID151 :return: è¿åç JSON æ°æ®å
152 """153 return self._post(154 'merchant/express/del',155 data={156 'template_id': template_id157 }158 )159 def update_express(self, template_id, delivery_template):160 """161 å¢å é®è´¹æ¨¡æ¿162 :param template_id: é®è´¹æ¨¡æ¿ID163 :param delivery_template: é®è´¹æ¨¡æ¿ä¿¡æ¯(å段说æ详è§å¢å é®è´¹æ¨¡æ¿)164 :return: è¿åç JSON æ°æ®å
165 """166 delivery_template['template_id'] = template_id167 return self._post(168 'merchant/express/update',169 data=delivery_template170 )171 def get_express(self, template_id):172 """173 è·åæå®IDçé®è´¹æ¨¡æ¿174 :param template_id: é®è´¹æ¨¡æ¿ID175 :return: è¿åç JSON æ°æ®å
176 """177 return self._post(178 'merchant/express/getbyid',179 data={180 'template_id': template_id181 }182 )183 def get_all_express(self):184 """185 è·åææé®è´¹æ¨¡æ¿186 :param template_id: é®è´¹æ¨¡æ¿ID187 :return: è¿åç JSON æ°æ®å
188 """189 return self._get(190 'merchant/express/getall'191 )192 def add_group(self, group_detail):193 """194 å¢å åç»195 :param group_detail: åååç»ä¿¡æ¯196 :return: è¿åç JSON æ°æ®å
197 """198 return self._post(199 'merchant/group/add',200 data=group_detail201 )202 def del_group(self, group_id):203 """204 å é¤åç»205 :param group_id: åååç»ID206 :return: è¿åç JSON æ°æ®å
207 """208 return self._post(209 'merchant/group/del',210 data={211 'group_id': group_id212 }213 )214 def update_group_property(self, group_id, group_properties):215 """216 ä¿®æ¹åç»å±æ§217 :param group_id: åååç»ID218 :param group_properties: åååç»å±æ§219 :return: è¿åç JSON æ°æ®å
220 """221 group_properties['group_id'] = group_id222 return self._post(223 'merchant/group/propertymod',224 data=group_properties225 )226 def update_group_product(self, group_id, product_data):227 """228 ä¿®æ¹åç»åå229 :param group_id: åååç»ID230 :param product_data: åç»ååä¿¡æ¯231 :return: è¿åç JSON æ°æ®å
232 """233 product_data['group_id'] = group_id234 return self._post(235 'merchant/group/productmod',236 data=product_data237 )238 def get_all_groups(self):239 """240 è·åææåç»241 :return: è¿åç JSON æ°æ®å
242 """243 return self._get(244 'merchant/group/getall'245 )246 def get_group(self, group_id):247 """248 æ ¹æ®åç»IDè·ååç»ä¿¡æ¯249 :param group_id: åååç»ID250 :return: è¿åç JSON æ°æ®å
251 """252 return self._post(253 'merchant/group/getbyid',254 data={255 'group_id': group_id256 }257 )258 def add_shelf(self, shelf_data):259 """260 å¢å è´§æ¶261 :param shelf_data: è´§æ¶è¯¦æ
ä¿¡æ¯262 :return: è¿åç JSON æ°æ®å
263 """264 return self._post(265 'merchant/shelf/add',266 data=shelf_data267 )268 def del_shelf(self, shelf_id):269 """270 å é¤è´§æ¶271 :param shelf_id: è´§æ¶ID272 :return: è¿åç JSON æ°æ®å
273 """274 return self._post(275 'merchant/shelf/del',276 data={277 'shelf_id': shelf_id278 }279 )280 def update_shelf(self, shelf_id, shelf_data):281 """282 ä¿®æ¹è´§æ¶283 :param shelf_id: è´§æ¶ID284 :param shelf_data: è´§æ¶è¯¦æ
285 :return: è¿åç JSON æ°æ®å
286 """287 shelf_data['shelf_id'] = shelf_id288 return self._post(289 'merchant/shelf/mod',290 data=shelf_data291 )292 def get_all_shelves(self):293 """294 è·åææè´§æ¶295 :return: è¿åç JSON æ°æ®å
296 """297 return self._get(298 'merchant/shelf/getall'299 )300 def get_shelf(self, shelf_id):301 """302 æ ¹æ®è´§æ¶IDè·åè´§æ¶ä¿¡æ¯303 :param shelf_id: è´§æ¶ID304 :return: è¿åç JSON æ°æ®å
305 """306 return self._post(307 'merchant/shelf/getbyid',308 data={309 'shelf_id': shelf_id310 }311 )312 def get_order(self, order_id):313 """314 æ ¹æ®è®¢åIDè·å订å详æ
315 :param order_id: 订åID316 :return: è¿åç JSON æ°æ®å
317 """318 return self._post(319 'merchant/order/getbyid',320 data={321 'order_id': order_id322 }323 )324 def query_order(self, status=None, begintime=None, endtime=None):325 """326 æ ¹æ®è®¢åç¶æ/å建æ¶é´è·å订å详æ
327 :param status: 订åç¶æ(ä¸å¸¦è¯¥å段-å
¨é¨ç¶æ, 2-å¾
åè´§, 3-å·²åè´§, 5-å·²å®æ, 8-ç»´æä¸, )328 :param begintime: 订åå建æ¶é´èµ·å§æ¶é´(ä¸å¸¦è¯¥å段åä¸æç
§æ¶é´åçé)329 :param endtime: 订åå建æ¶é´ç»æ¢æ¶é´(ä¸å¸¦è¯¥å段åä¸æç
§æ¶é´åçé)330 :return: è¿åç JSON æ°æ®å
331 """332 return self._post(333 'merchant/order/getbyfilter',334 data={335 'status': status,336 'begintime': begintime,337 'endtime': endtime338 }339 )340 def set_delivery(self, order_id, delivery_data):341 """342 ä¿®æ¹è´§æ¶343 :param order_id: 订åID344 :param delivery_data: ååç©æµä¿¡æ¯345 :return: è¿åç JSON æ°æ®å
346 """347 delivery_data['order_id'] = order_id348 return self._post(349 'merchant/shelf/setdeliverymod',350 data=delivery_data351 )352 def upload_image(self, media_file):353 """354 ä¸ä¼ å¾ç355 :param media_file: è¦ä¸ä¼ çæ件ï¼ä¸ä¸ª File-object356 :return: ä¸ä¼ æåæ¶è¿åå¾ç URL357 """358 res = self._post(359 url='merchant/common/upload_img',360 files={361 'media': media_file362 },363 result_processor=lambda x: x['url']364 )...
xlsx2sportsapp.py
Source:xlsx2sportsapp.py
1from openpyxl import load_workbook2wb2 = load_workbook('Move_2015_08_21_13_09_49_Running.xlsx')3print(wb2.get_sheet_names())4#['21 Aug 2015 13_09_49']5ws = wb2.active6#$seance_id=$_POST['seance_id'];7#$seance_name=$_POST['seance_name'];8#$sport_id=$_POST['sport_id'];9print(ws['A3'].value)10##1=velo11##2=escalade12##3=natation13##4=Footing14##5=Rando15##6=Ski de rando16##7=Skating17##8=SKI ALPIN18##10=musculation19#$date=$_POST['date'];20#$cal=$_POST['cal'];21print(ws['D3'].value)22#$dist=$_POST['dist'];23print(ws['E3'].value)24##in meter25#$duration=$_POST['duration'];26print(ws['C3'].value)27##in seconde to be converted HH:MM:ss28#$fat=$_POST['fat'];29#$above=$_POST['above'];30#$below=$_POST['below'];31#$in_zone=$_POST['in_zone'];32#$lower=$_POST['lower'];33#$upper=$_POST['upper'];34#$fmoy=$_POST['fmoy'];35print(ws['F3'].value)36#$fmax=$_POST['fmax'];37print(ws['S3'].value)38#$vmoy=$_POST['vmoy'];39print(ws['I3'].value)40#$vmax=$_POST['vmax'];41#$altitude=$_POST['altitude'];42#$url = $_POST['url'];...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!