Commit 23736d18 authored by Minkush Jain's avatar Minkush Jain

add script to register salsa account using http post method

parent 0de774e5
#!/usr/bin/python
# -*- coding: utf-8 -*-
# using requests and BeautifulSoup to automate salsa account registration
import requests
from bs4 import BeautifulSoup
import getpass
def register_account(
username,
full_name,
email_address,
user_password,
):
# Submitting data
url = 'https://signup.salsa.debian.org/register/guest/'
features = 'html.parser'
parse_link = requests.get(url)
# Scraping HTML data
soup = BeautifulSoup(parse_link.content)
form = soup.find('form')
fields = form.find('input')
token = fields['value']
# Defining data values
data = [
('csrf_token', token),
('username_prefix', username),
('name', full_name),
('email', email_address),
('password', user_password),
('confirm', user_password),
]
# Posting data and passing cookies
response = \
requests.post('https://signup.salsa.debian.org/register/guest/'
, cookies=parse_link.cookies, data=data)
if __name__ == '__main__':
print('Welcome to GSoC 2018')
print('Project: Wizard/GUI Helping Students get Started\n')
print('This is a program to automate the process of \new account creation on Salsa using HTTP Post.\n')
username = input('Enter you username: ')
full_name = input('Enter you name: ')
email_address = input('Enter you email: ')
user_password = getpass.getpass()
confirm_password = getpass.getpass(prompt='Confirm password: ')
register_account(username, full_name, email_address, user_password)
print("Congrats! Your new Salsa account has been created. Check your mail for further instructions")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment