Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- if __name__ == "__main__":
- URL = 'http://news-admin.ngenics.ai/admin/login/?next=/admin/'
- client = requests.session()
- client.get(URL) # sets cookie
- token = client.cookies['csrftoken']
- login_data = dict(username='admin',
- password='ExoPRVpaUhfZ$]6Cmza7ee',
- csrfmiddlewaretoken=token,
- next='/admin/')
- r = client.post(URL, data=login_data, headers=dict(Referer=URL))
- URL_Pers = 'http://news-admin.ngenics.ai/admin/public/person/add/'
- client.get(URL_Pers) # sets cookie
- token = client.cookies['csrftoken']
- person_data = {
- 'csrfmiddlewaretoken': token,
- 'surname_ru' : 'Зубко',
- 'first_name_ru' : 'Геннадий',
- 'surname_uk' : 'Зубко',
- 'first_name_uk' : 'Генадій',
- 'family_name_ru' : '',
- 'family_name_uk' : '',
- 'country_of_birth' : '',
- 'date_of_birth' : '',
- 'date_of_death' : '',
- 'official_position' : '',
- 'wiki_link' : '',
- 'description' : '',
- 'vkontakte_link' : '',
- 'facebook_link' : '',
- 'twitter_link' : '',
- 'livejournal_link' : '',
- 'youtube_link' : '',
- 'instagram_link' : '',
- 'is_active' : '',
- 'images-TOTAL_FORMS' : '',
- 'images-INITIAL_FORMS' : '',
- 'images-MIN_NUM_FORMS' : '',
- 'images-MAX_NUM_FORMS' : '',
- 'images-0-id' : '',
- 'images-0-person' : '',
- 'images-0-images' : '',
- 'images-1-id' : '',
- 'images-1-person' : '',
- 'images-1-images' : '',
- 'images-2-id' : '',
- 'images-2-person' : '',
- 'images-2-images' : '',
- 'images-__prefix__-id' : '',
- 'images-__prefix__-person' : '',
- 'images-__prefix__-images' : '',
- 'category-TOTAL_FORMS' : '',
- 'category-INITIAL_FORMS' : '',
- 'category-MIN_NUM_FORMS' : '',
- 'category-MAX_NUM_FORMS' : '',
- 'category-0-id' : '',
- 'category-0-person' : '',
- 'category-0-category' : '',
- 'category-1-id' : '',
- 'category-1-person' : '',
- 'category-1-category' : '',
- 'category-2-id' : '',
- 'category-2-person' : '',
- 'category-2-category' : '',
- 'category-__prefix__-id' : '',
- 'category-__prefix__-person' : '',
- 'category-__prefix__-category' : '',
- '_save' : ''
- }
- r = client.post(URL_Pers, data=person_data, headers=dict(Referer=URL_Pers))
- file = open("out.html", "w")
- file.write(r.text)
- file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement