Signal mailman remote IP via X-Forwarded-For.

master
q3k 2013-02-20 11:20:07 +01:00
parent 7e0f2edced
commit af052783b1
1 changed files with 3 additions and 1 deletions

View File

@ -25,7 +25,9 @@ def pull_feed_entries():
def mailman_subscribe(email, mailing_list):
password = "".join(random.choice(string.letters) for _ in range(8))
r = requests.post("https://lists.hackerspace.pl/subscribe/" + mailing_list, {"email": email, "fullname": "", "pw": password, "pw-conf": password, "email-button": "Zapisz", "digest": 0})
post = {"email": email, "fullname": "", "pw": password, "pw-conf": password, "email-button": "Zapisz", "digest": 0}
headers = {"X-Forwarded-For": request.remote_addr}
r = requests.post("https://lists.hackerspace.pl/subscribe/" + mailing_list, post, headers=headers)
if r.status_code != 200:
return False
return True