()
| 92 | |
| 93 | @app.route('/count/') |
| 94 | def getCount(): |
| 95 | proxies = proxy_handler.getAll() |
| 96 | http_type_dict = {} |
| 97 | source_dict = {} |
| 98 | for proxy in proxies: |
| 99 | http_type = 'https' if proxy.https else 'http' |
| 100 | http_type_dict[http_type] = http_type_dict.get(http_type, 0) + 1 |
| 101 | for source in proxy.source.split('/'): |
| 102 | source_dict[source] = source_dict.get(source, 0) + 1 |
| 103 | return {"http_type": http_type_dict, "source": source_dict, "count": len(proxies)} |
| 104 | |
| 105 | |
| 106 | def runFlask(): |