<commit_before>#!/usr/bin/python3
from bs4 import BeautifulSoup as bs
from requests import get, post, Session
from requests.utils import cookiejar_from_dict, dict_from_cookiejar

with open ("password.txt", "r") as password_file:
        password=password__file.read().replace('\n', '')

url = 'http://n-1.cc/'
username = 'maxigas'
post_url = url + 'action/login'
s = Session()
soup = bs(s.get(url).text)
tokens = []
soup = soup(class_='elgg-form-login')[0]
for x in soup.find_all('input', type='hidden'):
    token = x['value']
    if token != 'true':
        tokens.append(token)

data = {
    '__elgg_token':    tokens[0],
    '__elgg_ts':       tokens[1],
    'username':        username,
    'password':        password,
    'persistent':      'true',
    'returntoreferer': 'false' 
   }

#cookies = cookiejar_from_dict(dict_from_cookiejar(s.cookies))
#print('----')
#r = s.post(post_url, data=data, cookies=cookies, allow_redirects=True)
r = s.post(post_url, data=data)
print(r.text)
print(r.headers)
print(r.status_code)
#print(url,username,password,tokens)
print(cookies)
print(post_url)
<commit_msg>correct typo<commit_after>#!/usr/bin/python3
from bs4 import BeautifulSoup as bs
from requests import get, post, Session
from requests.utils import cookiejar_from_dict, dict_from_cookiejar

with open ("password.txt", "r") as password_file:
        password=password_file.read().replace('\n', '')

url = 'http://n-1.cc/'
username = 'maxigas'
post_url = url + 'action/login'
s = Session()
soup = bs(s.get(url).text)
tokens = []
soup = soup(class_='elgg-form-login')[0]
for x in soup.find_all('input', type='hidden'):
    token = x['value']
    if token != 'true':
        tokens.append(token)

data = {
    '__elgg_token':    tokens[0],
    '__elgg_ts':       tokens[1],
    'username':        username,
    'password':        password,
    'persistent':      'true',
    'returntoreferer': 'false' 
   }

#cookies = cookiejar_from_dict(dict_from_cookiejar(s.cookies))
#print('----')
#r = s.post(post_url, data=data, cookies=cookies, allow_redirects=True)
r = s.post(post_url, data=data)
print(r.text)
print(r.headers)
print(r.status_code)
#print(url,username,password,tokens)
#print(cookies)
print(post_url)

{'fraction_non_alphanumeric': 0.1656884875846501, 'fraction_numerical': 0.005417607223476298, 'mean_word_length': 4.2018779342723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1801658', 'n_tokens_mistral': 820, 'n_tokens_neox': 801, 'n_words': 161}