Chocolate Chip Cookies ? retrieve a webpage ?

Punkachu
9 years ago

1

Hi !

I am making a new Thread about retrieving a webpage.
I am using python.
I need to connect to a web link , then extract data to compute a result , which is already done, I shall send to another link.
But everytime I connect to the data page it will reload itself and randomly changes data.
So I need to handle the cookies session in order to get data and send the result to the second page without reloading the first page .

Did you understand ? XD

Any help ?

9replies
3voices
226views
Rex_Mundi
9 years ago

1

Have a look at python requests, it’s excellent for handling sessions.
http://docs.python-requests.org/en/latest/user/advanced/

dloser
9 years ago

1

Already suggested that to him. Not sure why a new thread is needed.

Punkachu
9 years ago

1

I ’ve already reading it, but I’d like to know , without any code or documentation how I supposed to do with words .
I mean what is the mechanism or trick to avoid the browser loading the current cookie and modifying it or deleting it .

Punkachu
9 years ago

1

I think I will just play with the cookie session which is indicate as follow http://docs.python-requests.org/en/latest/api/#api-cookies

Punkachu
9 years ago

1

Okay thanks dloser, it’s done

Punkachu
9 years ago

1

Just to make sure , what will be your implementation of this algorithm :
Un+1 = [ -28 + Un ] - [ n * 10 ]
U0 = -555

I did :
def suite(n): Un = U0 Unp1 = U0 for x in range(0, n): Un, Unp1 = Unp1, ((-28 + Un) - (x * 10))

It seems I did something wrong x )

dloser
9 years ago

1

The idea is that you solve challenges on your own. Add some prints to check the values produced and verify it by hand where needed.

Punkachu
9 years ago

1

Yes good advice ,
I solve my upper problem using this :


session = requests.Session()  
session.cookies.get_dict()  
response = session.get('YOUR URL')  
session.cookies.get_dict()  

Then use setter to customize nor modify your cookie.

You must be logged in to reply to this discussion. Login
1 of 10

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss