Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
1,207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.54 KB | None | 0 0
  1. In [1]: def valid_email(s):
  2. ...: if '@' not in s:
  3. ...: return False
  4. ...: if '.com' not in s:
  5. ...: return False
  6. ...: return True
  7. ...:
  8. ...:
  9.  
  10. In [2]: valid_email('ahmed@gmail.com')
  11. Out[2]: True
  12.  
  13. In [3]: valid_email('ahmed@gmail.com...')
  14. Out[3]: True
  15.  
  16. In [4]: valid_email('ahmed@@@gmail.com...')
  17. Out[4]: True
  18.  
  19. In [5]: valid_email('ahmed@@@gmail.net...')
  20. Out[5]: False
  21.  
  22. In [6]: valid_email('ahmed@gmail.net')
  23. Out[6]: False
  24.  
  25. In [7]:
  26.  
  27. In [7]:
  28.  
  29. In [7]: #letters or numbers + @ + more letters or numbers + . + letters
  30.  
  31. In [8]: import re
  32.  
  33. In [9]: mys = "32"
  34.  
  35. In [10]: re.findall?
  36. Signature: re.findall(pattern, string, flags=0)
  37. Docstring:
  38. Return a list of all non-overlapping matches in the string.
  39.  
  40. If one or more capturing groups are present in the pattern, return
  41. a list of groups; this will be a list of tuples if the pattern
  42. has more than one group.
  43.  
  44. Empty matches are included in the result.
  45. File: /usr/lib/python3.6/re.py
  46. Type: function
  47.  
  48. In [11]: re.findall('17', mys)
  49. Out[11]: []
  50.  
  51. In [12]: re.findall('32', mys)
  52. Out[12]: ['32']
  53.  
  54. In [13]: mys = "323215"
  55.  
  56. In [14]: re.findall('32', mys)
  57. Out[14]: ['32', '32']
  58.  
  59. In [15]: re.findall('3232', mys)
  60. Out[15]: ['3232']
  61.  
  62. In [16]: re.findall('15', mys)
  63. Out[16]: ['15']
  64.  
  65. In [17]: re.findall('6', mys)
  66. Out[17]: []
  67.  
  68. In [18]: re.findall('\d', mys)
  69. Out[18]: ['3', '2', '3', '2', '1', '5']
  70.  
  71. In [19]: re.findall('6|2', mys)
  72. Out[19]: ['2', '2']
  73.  
  74. In [20]: re.findall('3|2', mys)
  75. Out[20]: ['3', '2', '3', '2']
  76.  
  77. In [21]: re.findall('\d{3}', mys)
  78. Out[21]: ['323', '215']
  79.  
  80. In [22]: mys
  81. Out[22]: '323215'
  82.  
  83. In [23]: re.findall('\d{4}', mys)
  84. Out[23]: ['3232']
  85.  
  86. In [24]: re.findall('\d{5}', mys)
  87. Out[24]: ['32321']
  88.  
  89. In [25]: re.findall('\d{5},', mys)
  90. Out[25]: []
  91.  
  92. In [26]: re.findall('\d{5,}', mys)
  93. Out[26]: ['323215']
  94.  
  95. In [27]: re.findall('\d{2,}', mys)
  96. Out[27]: ['323215']
  97.  
  98. In [28]: re.findall('\d+', mys)
  99. Out[28]: ['323215']
  100.  
  101. In [29]: re.findall('\d*', mys)
  102. Out[29]: ['323215', '']
  103.  
  104. In [30]: re.findall('\d+', mys)
  105. Out[30]: ['323215']
  106.  
  107. In [31]: name = 'nayer'
  108.  
  109. In [32]: re.findall('nayer', name)
  110. Out[32]: ['nayer']
  111.  
  112. In [33]: re.findall('nay', name)
  113. Out[33]: ['nay']
  114.  
  115. In [34]: re.findall('nay+', name)
  116. Out[34]: ['nay']
  117.  
  118. In [35]: re.findall('[a-z]', name)
  119. Out[35]: ['n', 'a', 'y', 'e', 'r']
  120.  
  121. In [36]: re.findall('[a-z]+', name)
  122. Out[36]: ['nayer']
  123.  
  124. In [37]: mys = "323215"
  125.  
  126. In [38]: re.findall('[0-9]', name)
  127. Out[38]: []
  128.  
  129. In [39]: re.findall('[0-9]', mys)
  130. Out[39]: ['3', '2', '3', '2', '1', '5']
  131.  
  132. In [40]: re.findall('[0-3]', mys)
  133. Out[40]: ['3', '2', '3', '2', '1']
  134.  
  135. In [41]: person_name = "[a-z]+\s[a-z]" #"Ahmed Thabet"
  136.  
  137. In [42]: re.findall(person_name, "Ahmed Thabet")
  138. Out[42]: []
  139.  
  140. In [43]: re.findall(person_name, "ahmed thabet")
  141. Out[43]: ['ahmed t']
  142.  
  143. In [44]: person_name = "[a-z]+\s[a-z]+" #"Ahmed Thabet"
  144.  
  145. In [45]: re.findall(person_name, "ahmed thabet")
  146. Out[45]: ['ahmed thabet']
  147.  
  148. In [46]: re.findall(person_name, "Ahmed Thabet")
  149. Out[46]: []
  150.  
  151. In [47]: person_name = "[a-zA-Z]+\s[a-zA-Z]+" #"Ahmed Thabet"
  152.  
  153. In [48]: re.findall(person_name, "Ahmed Thabet")
  154. Out[48]: ['Ahmed Thabet']
  155.  
  156. In [49]: person_name = "\w+\s\w+" #"Ahmed Thabet"
  157.  
  158. In [50]: re.findall(person_name, "Ahmed Thabet")
  159. Out[50]: ['Ahmed Thabet']
  160.  
  161. In [51]: re.findall(person_name, "Ahmed Thabet213")
  162. Out[51]: ['Ahmed Thabet213']
  163.  
  164. In [52]: re.findall(person_name, "Ahmed Thabet")
  165. Out[52]: ['Ahmed Thabet']
  166.  
  167. In [53]: person_email = "\w+@\w+\.[a-z]+" # ahmed213213@gmail.com
  168.  
  169. In [54]: re.findall(person_email, "nayer@gmail.com")
  170. Out[54]: ['nayer@gmail.com']
  171.  
  172. In [55]: re.findall(person_email, "nayer@gmail.net")
  173. Out[55]: ['nayer@gmail.net']
  174.  
  175. In [56]: re.findall(person_email, "nayer..@gmail.net")
  176. Out[56]: []
  177.  
  178. In [57]: re.findall(person_email, "nayer..@gmail....net")
  179. Out[57]: []
  180.  
  181. In [58]: re.findall(person_email, "nayer@@gmail.net")
  182. Out[58]: []
  183.  
  184. In [59]: re.findall(person_email, "nayer.sobhy@gmail.net")
  185. Out[59]: ['sobhy@gmail.net']
  186.  
  187. In [60]: person_email = "\w+\.\w+@\w+\.[a-z]+" # ahmed213213@gmail.com
  188.  
  189. In [61]: re.findall(person_email, "nayer.sobhy@gmail.net")
  190. Out[61]: ['nayer.sobhy@gmail.net']
  191.  
  192. In [62]: person_email = "\w+(\.\w+)?@\w+\.[a-z]+" # ahmed213213@gmail.com
  193.  
  194. In [63]: re.findall(person_email, "nayer.sobhy@gmail.net")
  195. Out[63]: ['.sobhy']
  196.  
  197. In [64]: person_email = "\w+(\.\w+?)?@\w+\.[a-z]+" # ahmed213213@gmail.com
  198.  
  199. In [65]: re.findall(person_email, "nayer.sobhy@gmail.net")
  200. Out[65]: ['.sobhy']
  201.  
  202. In [66]: person_email = "\w+?(\.\w+)@\w+\.[a-z]+" # ahmed213213@gmail.com
  203.  
  204. In [67]: re.findall(person_email, "nayer.sobhy@gmail.net")
  205. Out[67]: ['.sobhy']
  206.  
  207. In [68]: re.findall(".3", "13")
  208. Out[68]: ['13']
  209.  
  210. In [69]: re.findall(".3", "23")
  211. Out[69]: ['23']
  212.  
  213. In [70]: re.findall(".3", "53")
  214. Out[70]: ['53']
  215.  
  216. In [71]: re.findall(".3", "35")
  217. Out[71]: []
  218.  
  219. In [72]: re.findall("-3", "-3")
  220. Out[72]: ['-3']
  221.  
  222. In [73]: re.findall("-3", ".3")
  223. Out[73]: []
  224.  
  225. In [74]: re.findall("-3", "\.3")
  226. Out[74]: []
  227.  
  228. In [75]: re.findall("-3", "-\d")
  229. Out[75]: []
  230.  
  231. In [76]: re.findall("-3", "\-\d")
  232. Out[76]: []
  233.  
  234. In [77]: re.findall("-\d", "-3")
  235. Out[77]: ['-3']
  236.  
  237. In [78]: re.findall("-\d", "-5")
  238. Out[78]: ['-5']
  239.  
  240. In [79]: re.findall("\d", "-5")
  241. Out[79]: ['5']
  242.  
  243. In [80]: import requests
  244.  
  245. In [81]: respones = requests.get("https://codescalers.com")
  246.  
  247. In [82]: response = _
  248.  
  249. In [83]: response
  250. Out[83]: ['5']
  251.  
  252. In [84]:
  253.  
  254. In [84]:
  255.  
  256. In [84]: response = requests.get("https://codescalers.com")
  257.  
  258. In [85]: response.status_code
  259. Out[85]: 200
  260.  
  261. In [86]: body = response.content
  262.  
  263. In [87]: body
  264. Out[87]: b'<!DOCTYPE html>\n<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n<title>Codescalers</title>\n<meta charset="UTF-8">\n<meta name="viewport" content="width=device-width, initial-scale=1.0">\n\n<meta name="description" content="CodeScalers focus on building and operating the perfect datacenter &amp; cloud architecture">\n<meta name="keywords" content="CodeScalers, CodeScaler, Cloud computing, Data center, Datacenter, IAAS, PAAS, SAAS, Amplidata, Awingu, vScalers, Racktivity, Open vSolutions, Incubaid">\n<link rel="shortcut icon" type="image/x-icon" href="./images/favicon.ico">\n<link href="http://fonts.googleapis.com/css?family=Open+Sans|Dosis:200,400,800" type="text/css" rel="stylesheet">\n<link href="./css/bootstrap.min.css" type="text/css" rel="stylesheet">\n<link href="./css/font-awesome.css" type="text/css" rel="stylesheet">\n<link href="./css/custom.css" type="text/css" rel="stylesheet">\n<link href="./css/neat.css" type="text/css" rel="stylesheet">\n\n</head>\n\t<body>\n\t\t\n \n\n \n\n \n\n \n \n \n\n \n \n <nav id="mainMenu" class="navbar navbar-default navbar-fixed-top" role="navigation">\n <div class="container">\n <div class="navbar-header">\n <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">\n <span class="sr-only">Toggle navigation</span>\n <span class="icon-bar"></span>\n <span class="icon-bar"></span>\n <span class="icon-bar"></span>\n </button>\n <a class="navbar-brand" href="./"><img src="./images/logo.png" alt="logo"></a>\n </div>\n <div class="collapse navbar-collapse navbar-ex1-collapse">\n <ul class="nav navbar-nav navbar-right">\n <li class=""><a href="./">Home</a></li>\n <li><a href="./about-us/">About us</a></li>\n <li><a href="./careers/">Careers</a></li>\n <li><a href="./contact-us/">Contact us</a></li>\n </ul>\n </div>\n </div>\n </nav>\n \n \n\n \n \n \n\n \n \n \n\n \n\n\n\t\t \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<div class="responsive-slider-parallax" data-spy="responsive-slider" data-parallax="true" data-parallax-direction="-1" data-transitiontime="1000" data-autoplay="true">\n <div class="slides-container" data-group="slides">\n <ul>\n <li>\n <div class="slide-body" data-group="slide">\n <div class="container">\n <div class="wrapper">\n <div class="caption header" data-animate="slideAppearRightToLeft" data-delay="0" data-length="300">\n <h2>Welcome to CodeScalers</h2>\n <p class="sub text-left" data-animate="slideAppearLeftToRight" data-delay="300" data-length="300"><span>International Software Development</span></p>\n <p class="sub text-left" data-animate="slideAppearLeftToRight" data-delay="500" data-length="300"><span>Specialised in Cloud Computing Projects</span></p>\n <p class="sub text-left" data-animate="slideAppearLeftToRight" data-delay="700" data-length="300"><span>Offices in Cairo and El Gouna</span></p>\n </div>\n </div>\n </div>\n </div>\n </li>\n <li>\n <div class="slide-body" data-group="slide">\n <div class="container">\n <div class="wrapper">\n <div class="caption header text-center" data-animate="slideAppearUpToDown" data-delay="0" data-length="300">\n <h2>Changing the way to deliver IT</h2>\n <p class="sub" data-animate="slideAppearDownToUp" data-delay="300" data-length="300"><span>We rechallenge existing technologies</span></p>\n <p class="sub" data-animate="slideAppearDownToUp" data-delay="500" data-length="300"><span>We try to solve the root cause of issues</span></p>\n <p class="sub" data-animate="slideAppearDownToUp" data-delay="700" data-length="300"><span>We have our own software automation tools</span></p>\n </div>\n </div>\n </div>\n </div>\n </li>\n <li>\n <div class="slide-body" data-group="slide">\n <div class="container">\n <div class="wrapper">\n <div class="caption header text-right" data-animate="slideAppearDownToUp" data-delay="0" data-length="300">\n <h2>Join us</h2>\n <p class="sub" data-animate="slideAppearUpToDown" data-delay="300" data-length="300"><span>We are always looking for talented engineers</span></p>\n <p class="sub" data-animate="slideAppearUpToDown" data-delay="500" data-length="300"><span>System administrators and developers</span></p>\n <p class="sub" data-animate="slideAppearUpToDown" data-delay="700" data-length="300"><span>Working for international customers</span></p>\n </div>\n </div>\n </div>\n </div>\n </li>\n </ul>\n </div>\n <div class="pages-wrapper">\n <ol class="pages">\n <li><a data-jump-to="1">1</a></li>\n <li><a data-jump-to="2">2</a></li>\n <li><a data-jump-to="3">3</a></li>\n </ol>\n </div>\n </div>\n\n\n\n\n\n\n\n\n\n\t\t\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<section>\n <div class="container">\n <div class="row">\n <div class="col-sm-4 col-md-4">\n <div class="thumbnail info-thumbnail-link color-black">\n <div class="caption">\n <h3><span class="fa fa-flag color-lead"></span> Our Vision</h3>\n <p class="description">Our dream has been focused on building and operating the perfect datacenter cloud architecture. To make this dream reality, we have worked together with a great team of people and have created some unique technology and firmly believe that we can call ourselves the best cloud experts in the world. What makes us so different is that we think out of the box and try to create groundbreaking disruptive technologies. We hope to make IT as easy to use, reliable and scalable as electricity.</p>\n </div>\n </div>\n </div>\n <div class="col-sm-4 col-md-4">\n <div class="thumbnail info-thumbnail-link background-lead-light">\n <div class="caption">\n <h3><span class="fa fa-group"></span> The Team</h3>\n <p class="description">CodeScalers is run by A team of datacenter experts that has helped build over a dozen largescale data centers during the past two decades. The team has also developed cloud software companies, datacenter software as well as highend and mid market hosting companies. From that experience, we learnt that significant improvements for a cloud solution can only be achieved when the entire cloud ecosystem is looked at including Datacenter, Power Management, Physical infrastructure, Management Platform, User Interfaces.</p>\n </div>\n </div>\n </div>\n <div class="col-sm-4 col-md-4">\n <div class="thumbnail info-thumbnail-link color-black">\n <div class="caption">\n <h3><span class="fa fa-cogs color-lead"></span> Cloud Computing</h3>\n <p class="description">Around 2005, Amazon took the lead in the cloud computing industry with its S3 and EC2 services. Google (AppEngine) and Salesforce (Force.com) have also become prominent players in the sector. The ecosystem has segmented into Infrastructure as a Service (IAAS), Platform as a Service (PAAS) and Software as a Service (SAAS). Cloud computing is experiencing a growing popularity across all industry segments, with a lot of activity within the top layer. Incubaid has identified many opportunities for innovation in the IAAS layer.</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n</section>\n\n\n\n\n\n\t\t\n\n\n\n\n\n\n\n\n<footer class="background-dark-gray color-white">\n <div class="container">\n <div class="row">\n <div class="col-md-3">\n <h3>Menu</h3>\n <ul class="nav-footer">\n <li><a href="./">Home</a></li>\n <li><a href="./about-us/">About us</a></li>\n <li><a href="./careers/">Careers</a></li>\n <li><a href="./contact-us/">Contact Us</a></li>\n </ul>\n </div>\n <div class="col-md-4">\n <h3>Welcome to CodeScalers</h3>\n <p class="testimonial">International Software Development and Specialised in Cloud Computing Projects, We rechallenge existing technologies also we try to solve the root cause of issues and we have our own software automation tools</p> \n </div>\n <div class="col-md-5">\n <h3>Contact us</h3>\n <form class="form-horizontal contact_form" method="POST" name="contact_form" action="//formspree.io/nayer@codescalers.com">\n <div class="alert" style="display: none"></div>\n <input type="hidden" name="_next" value="/thanks" />\n <input type="hidden" name="smtp_key" value="None">\n <input type="hidden" name="receiver_email" value="contact@codescalers.com">\n <input type="hidden" name="format" value="json">\n <input type="hidden" name="subject" value="About CodeScalers.com">\n <div style="display: none">\n <input type="text" id="honeypot" name="honeypot">\n </div>\n <div class="form-group">\n <label for="sender_name" class="col-lg-3 control-label">Name</label>\n <div class="col-lg-9">\n <input name="sender_name" required placeholder="Name" class="form-control input-lg" type="text">\n </div>\n </div>\n <div class="form-group">\n <label for="sender_email" class="col-lg-3 control-label">Email</label>\n <div class="col-lg-9">\n <input name="sender_email" required placeholder="Email" class="form-control input-lg" type="email">\n </div>\n </div>\n <div class="form-group">\n <label for="body" class="col-lg-3 control-label">Content</label>\n <div class="col-lg-9">\n <textarea name="body" required rows="3" class="form-control input-lg"></textarea>\n </div>\n </div>\n <div class="form-group">\n <div class="col-lg-offset-3 col-lg-9">\n <button class="btn btn-lead btn-lg" data-loading-text="Sending..." type="submit"> Send us an email </button>\n </div>\n </div>\n </form>\n </div>\n </div>\n <div class="row">\n <hr>\n <div class="col-md-6 copyMargin"> All rights reserved \xc2\xa9 2014 <a href="http://www.codescalers.com/">CodeScalers</a> </div>\n </div>\n </div>\n</footer>\n <script type="text/javascript" src="./js/clipboard.min.js"></script>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\n\t\t<script type="text/javascript" src="./js/jquery-latest.js"></script>\n <script type="text/javascript" src="./js/bootstrap.min.js"></script>\n <script type="text/javascript" src="./js/general.js"></script>\n <script type="text/javascript" src="./js/responsive-slider.js"></script>\n <script type="text/javascript" src="./js/jquery.event.move.js"></script>\n\t\t<script type="text/javascript" src="./js/jquery.form.js"></script>\t\t\n\t</body>\n</html>\n\n\n\n'
  265.  
  266. In [88]: re.findall("<title>\w+</title>", body)
  267. ---------------------------------------------------------------------------
  268. TypeError Traceback (most recent call last)
  269. <ipython-input-88-523409b34c5d> in <module>()
  270. ----> 1 re.findall("<title>\w+</title>", body)
  271.  
  272. /usr/lib/python3.6/re.py in findall(pattern, string, flags)
  273. 220
  274. 221 Empty matches are included in the result."""
  275. --> 222 return _compile(pattern, flags).findall(string)
  276. 223
  277. 224 def finditer(pattern, string, flags=0):
  278.  
  279. TypeError: cannot use a string pattern on a bytes-like object
  280.  
  281. In [89]: re.findall("<title>\w+</title>", body.decode())
  282. Out[89]: ['<title>Codescalers</title>']
  283.  
  284. In [90]: re.findall("<a>\w+</a>", body.decode())
  285. Out[90]: []
  286.  
  287. In [91]: re.findall("<a.+>\w+</a>", body.decode())
  288. Out[91]:
  289. ['<a href="./">Home</a>',
  290. '<a href="./careers/">Careers</a>',
  291. '<a data-jump-to="1">1</a>',
  292. '<a data-jump-to="2">2</a>',
  293. '<a data-jump-to="3">3</a>',
  294. '<a href="./">Home</a>',
  295. '<a href="./careers/">Careers</a>',
  296. '<a href="http://www.codescalers.com/">CodeScalers</a>']
  297.  
  298. In [92]: re.findall("<a.+>(\w+)</a>", body.decode())
  299. Out[92]: ['Home', 'Careers', '1', '2', '3', 'Home', 'Careers', 'CodeScalers']
  300.  
  301. In [93]: re.findall("<a.+>\w+</a>", body.decode())
  302. Out[93]:
  303. ['<a href="./">Home</a>',
  304. '<a href="./careers/">Careers</a>',
  305. '<a data-jump-to="1">1</a>',
  306. '<a data-jump-to="2">2</a>',
  307. '<a data-jump-to="3">3</a>',
  308. '<a href="./">Home</a>',
  309. '<a href="./careers/">Careers</a>',
  310. '<a href="http://www.codescalers.com/">CodeScalers</a>']
  311.  
  312. In [94]: re.findall("<a.+>(\w+)</a>", body.decode())
  313. Out[94]: ['Home', 'Careers', '1', '2', '3', 'Home', 'Careers', 'CodeScalers']
  314.  
  315. In [95]: re.findall("<a(.+)>\w+</a>", body.decode())
  316. Out[95]:
  317. [' href="./"',
  318. ' href="./careers/"',
  319. ' data-jump-to="1"',
  320. ' data-jump-to="2"',
  321. ' data-jump-to="3"',
  322. ' href="./"',
  323. ' href="./careers/"',
  324. ' href="http://www.codescalers.com/"']
  325.  
  326. In [96]: re.findall("<a href(.+)>\w+</a>", body.decode())
  327. Out[96]:
  328. ['="./"',
  329. '="./careers/"',
  330. '="./"',
  331. '="./careers/"',
  332. '="http://www.codescalers.com/"']
  333.  
  334. In [97]: re.findall("<a href=(.+)>\w+</a>", body.decode())
  335. Out[97]:
  336. ['"./"',
  337. '"./careers/"',
  338. '"./"',
  339. '"./careers/"',
  340. '"http://www.codescalers.com/"']
  341.  
  342. In [98]: re.findall("<a.+>\w+</a>", body.decode())
  343. Out[98]:
  344. ['<a href="./">Home</a>',
  345. '<a href="./careers/">Careers</a>',
  346. '<a data-jump-to="1">1</a>',
  347. '<a data-jump-to="2">2</a>',
  348. '<a data-jump-to="3">3</a>',
  349. '<a href="./">Home</a>',
  350. '<a href="./careers/">Careers</a>',
  351. '<a href="http://www.codescalers.com/">CodeScalers</a>']
  352.  
  353. In [99]: requests.get("https://nayer.sobhy.com")
  354. ---------------------------------------------------------------------------
  355. CertificateError Traceback (most recent call last)
  356. /usr/lib/python3/dist-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
  357. 600 body=body, headers=headers,
  358. --> 601 chunked=chunked)
  359. 602
  360.  
  361. /usr/lib/python3/dist-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
  362. 345 try:
  363. --> 346 self._validate_conn(conn)
  364. 347 except (SocketTimeout, BaseSSLError) as e:
  365.  
  366. /usr/lib/python3/dist-packages/urllib3/connectionpool.py in _validate_conn(self, conn)
  367. 851 if not getattr(conn, 'sock', None): # AppEngine might not have `.sock`
  368. --> 852 conn.connect()
  369. 853
  370.  
  371. /usr/lib/python3/dist-packages/urllib3/connection.py in connect(self)
  372. 345 )
  373. --> 346 _match_hostname(cert, self.assert_hostname or hostname)
  374. 347
  375.  
  376. /usr/lib/python3/dist-packages/urllib3/connection.py in _match_hostname(cert, asserted_hostname)
  377. 355 try:
  378. --> 356 match_hostname(cert, asserted_hostname)
  379. 357 except CertificateError as e:
  380.  
  381. /usr/lib/python3.6/ssl.py in match_hostname(cert, hostname)
  382. 326 "doesn't match either of %s"
  383. --> 327 % (hostname, ', '.join(map(repr, dnsnames))))
  384. 328 elif len(dnsnames) == 1:
  385.  
  386. CertificateError: hostname 'nayer.sobhy.com' doesn't match either of '*.parkingcrew.net', 'parkingcrew.net'
  387.  
  388. During handling of the above exception, another exception occurred:
  389.  
  390. MaxRetryError Traceback (most recent call last)
  391. ~/.local/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
  392. 448 retries=self.max_retries,
  393. --> 449 timeout=timeout
  394. 450 )
  395.  
  396. /usr/lib/python3/dist-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
  397. 638 retries = retries.increment(method, url, error=e, _pool=self,
  398. --> 639 _stacktrace=sys.exc_info()[2])
  399. 640 retries.sleep()
  400.  
  401. /usr/lib/python3/dist-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
  402. 387 if new_retry.is_exhausted():
  403. --> 388 raise MaxRetryError(_pool, url, error or ResponseError(cause))
  404. 389
  405.  
  406. MaxRetryError: HTTPSConnectionPool(host='nayer.sobhy.com', port=443): Max retries exceeded with url: / (Caused by SSLError(CertificateError("hostname 'nayer.sobhy.com' doesn't match either of '*.parkingcrew.net', 'parkingcrew.net'",),))
  407.  
  408. During handling of the above exception, another exception occurred:
  409.  
  410. SSLError Traceback (most recent call last)
  411. <ipython-input-99-51851f5b6bd6> in <module>()
  412. ----> 1 requests.get("https://nayer.sobhy.com")
  413.  
  414. ~/.local/lib/python3.6/site-packages/requests/api.py in get(url, params, **kwargs)
  415. 73
  416. 74 kwargs.setdefault('allow_redirects', True)
  417. ---> 75 return request('get', url, params=params, **kwargs)
  418. 76
  419. 77
  420.  
  421. ~/.local/lib/python3.6/site-packages/requests/api.py in request(method, url, **kwargs)
  422. 58 # cases, and look like a memory leak in others.
  423. 59 with sessions.Session() as session:
  424. ---> 60 return session.request(method=method, url=url, **kwargs)
  425. 61
  426. 62
  427.  
  428. ~/.local/lib/python3.6/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
  429. 531 }
  430. 532 send_kwargs.update(settings)
  431. --> 533 resp = self.send(prep, **send_kwargs)
  432. 534
  433. 535 return resp
  434.  
  435. ~/.local/lib/python3.6/site-packages/requests/sessions.py in send(self, request, **kwargs)
  436. 644
  437. 645 # Send the request
  438. --> 646 r = adapter.send(request, **kwargs)
  439. 647
  440. 648 # Total elapsed time of the request (approximately)
  441.  
  442. ~/.local/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
  443. 512 if isinstance(e.reason, _SSLError):
  444. 513 # This branch is for urllib3 v1.22 and later.
  445. --> 514 raise SSLError(e, request=request)
  446. 515
  447. 516 raise ConnectionError(e, request=request)
  448.  
  449. SSLError: HTTPSConnectionPool(host='nayer.sobhy.com', port=443): Max retries exceeded with url: / (Caused by SSLError(CertificateError("hostname 'nayer.sobhy.com' doesn't match either of '*.parkingcrew.net', 'parkingcrew.net'",),))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement