Python HTTP POST

21.08.2020 / 0 comments

import requests url = ‘http://hostname:80/script.php’ my_post = {‘key’: key} my_response = requests.post(url, data = my_post) my_response.encoding = ‘windows-1251’ my_html = my_response.text  

Python parsing

20.08.2020 / 0 comments

import pyparsing text = ‘test value: 123<br>’ left = ‘Доступные баллы для списания:’ right = ‘<br>’ rule = pyparsing.nestedExpr(left, right) for match in rule.searchString(text): if match[0].asList(): print(match[0].asList()[0])  

Установка пакетов python

10.07.2020 / 0 comments

pip install requests pyyaml jinja2

цикл по всем в каталоге на Python

09.07.2020 / 0 comments

import os for filename in os.listdir(‘dirname’): callthecommandhere(blablahbla, filename, foo)