Tuesday, August 22, 2023

Python POST local access

 import requests

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.7,ro;q=0.3',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Origin': 'www.traduceri.pluto.ro',
    'DNT': '1',
    'Connection': 'keep-alive',
    'Referer': 'https://letconex.blogspot.com/',
    'Upgrade-Insecure-Requests': '1',
    'Sec-GPC': '1',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache',
}

data = {
    'sourcelanguagenames': 'DE',
    'targetlanguagenames': 'RO',
    'dictionaries': [
        'Hallo.ro',
        'Dict.cc',
        'IATE',
        'DWDS',
    ],
    'bimono': 'Include monolingual ressources',
    'searchformterm': 'Veredelung',
}

response = requests.post('http://192.168.2.100:5000/resultdic.html', headers=headers, data=data)

print(response.text)