Python urllib2 login to minecraft net

0 votes

I have a doubt. I'm creating a script that lists all classic servers when logging into Minecraft.net. However, my script simply reroutes me to minecraft.net/login when I run it. What I have thus far is as follows:

import urllib2
import urllib
import re

url = "https://www.minecraft.net/login"
page = urllib2.urlopen(url)
data = page.read()
page.close()

authToken = re.search('name="authenticityToken"[\s]+value="(.+)"', data).group(1)

data_dict = {
    "username": "USERNAME",
    "password": "PASSWORD",
    "remember": "true",
    #"redirect": "https://www.minecraft.net",
    "authenticityToken": authToken
}
print urllib.urlencode(data_dict)
req = urllib2.Request(url, data=urllib.urlencode(data_dict))
page = urllib2.urlopen(req)
data = page.read()
page.close()

Aug 31, 2023 in Python by Edureka
• 220 points
131 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

Need a python script to login into a website but username and password are in a txt file (Selenium automation script)

I had a similar requirement. I had ...READ MORE

answered Jan 31, 2019 in Python by Omkar
• 69,230 points
7,970 views
0 votes
1 answer

Is it possible to access .NET code written in C# from Python?

If you want to mainly base your ...READ MORE

answered Jul 18, 2019 in Python by Arvind
• 3,040 points
1,305 views
+2 votes
2 answers

How to make a laplacian pyramid using OpenCV python?

down voteacceptTheeThe problem is that you're iterating ...READ MORE

answered Apr 3, 2018 in Python by charlie_brown
• 7,720 points
4,557 views
+3 votes
5 answers

How to read multiple data files in python

Firstly we will import pandas to read ...READ MORE

answered Apr 6, 2018 in Python by DeepCoder786
• 1,720 points
14,878 views
+4 votes
7 answers
+1 vote
5 answers

convert string to int python

Using list comprehensions: t2 = [map(int, list(l)) for ...READ MORE

answered Oct 18, 2018 in Python by donald
1,353 views
0 votes
1 answer

Python urllib2 login to minecraft net

Why not use Selenium over urllib? Selenium ...READ MORE

answered Sep 25, 2023 in Python by Rajarshi
• 470 points
329 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,135 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP