473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Log-in to forums (using cookielib)?

Hi,

I need to login to a online forum, like a phpbb forum, and leave a
message there. I figured I need to use cookielib, but the documentation
of cookielib is not very clear to me.

I tried to just copy/paste all the cookies from FireFox into my
Python-program, like this:
import cookielib, urllib2, urllib
cookiejar=cookielib.CookieJar()
urlOpener=urllib2.build_opener(urllib2.HTTPCookieP rocessor(cookiejar))
values={'__utmb':'1234', 'mybbuser':'1234_1234', '__utmz':'1234',
'sid':'1234', '__utma':'1234'}
data=urllib.urlencode(values)
request=urllib2.Request("http://ep2.nl",data)
url=urlOpener.open(request)
page=url.read(1024000)

Can someone please tell me how I should log-in and leave a message on
the board?
May 1 '07 #1
3 2245
En Tue, 01 May 2007 04:44:57 -0300, Olivier Oost <no****@gmail.com>
escribió:
I need to login to a online forum, like a phpbb forum, and leave a
message there. I figured I need to use cookielib, but the documentation
of cookielib is not very clear to me.
Can someone please tell me how I should log-in and leave a message on
the board?
Sure. But considering that this smells like an Automatic Spamming Machine,
I hope nobody will.

--
Gabriel Genellina
May 1 '07 #2
Gabriel Genellina wrote:
En Tue, 01 May 2007 04:44:57 -0300, Olivier Oost <no****@gmail.com>
escribió:
>I need to login to a online forum, like a phpbb forum, and leave a
message there. I figured I need to use cookielib, but the
documentation of cookielib is not very clear to me.
Can someone please tell me how I should log-in and leave a message on
the board?

Sure. But considering that this smells like an Automatic Spamming
Machine, I hope nobody will.

--Gabriel Genellina
No, it's not meant as a spamming machine. I only need to post a message
and then (if that's possible) lock the topic (I'm admin on the forum
where I need this). The program first needs to read the topic for
certain words (that's already working), and then reply that those words
aren't welcome.

I hope I made myself clear.
May 1 '07 #3
En Tue, 01 May 2007 05:39:14 -0300, Olivier Oost <no****@gmail.com>
escribió:
Gabriel Genellina wrote:
>En Tue, 01 May 2007 04:44:57 -0300, Olivier Oost <no****@gmail.com>
escribió:
>>Can someone please tell me how I should log-in and leave a message on
the board?
Sure. But considering that this smells like an Automatic Spamming
Machine, I hope nobody will.
No, it's not meant as a spamming machine. I only need to post a message
and then (if that's possible) lock the topic (I'm admin on the forum
where I need this). The program first needs to read the topic for
certain words (that's already working), and then reply that those words
aren't welcome.
I would verify that in the forum code if possible, not remotely.
Anyway, the examples at the end of the cookielib section in the library
reference are what you need: create an OpenerDirector using
urllib2.build_opener, adding a suitable HTTPCookieProcessor handler.

--
Gabriel Genellina
May 1 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: syncman | last post by:
In C, I would always make a log() function instead of using printfs, so that I could disable the messages or otherwise process them, all in one place. This worked in 1 line, for constant strings,...
4
by: hype | last post by:
Hi, How can I find out how much space has been used in the log file and how much of it is free or yet to be used ? Thanks, Hype
5
by: peter Willis | last post by:
Hello, Is there a way to recover from the following error? I have (had) an existing database and wish not to lose the data tables. Thanks for any help, Pete
1
by: francescomoi | last post by:
Hi. I'm experiencing some problems due to big '/var/log/mysqld.log' size (199 Mbytes), and I'd like to know if there's any method to set this file's maximum size. Thank you very much. --f
7
by: Trevor Best | last post by:
According to BOL <--- BACKUP LOG Specifies a backup of the transaction log only. The log is backed up from the last successfully executed LOG backup to the current end of the log. Once the log...
5
by: laststubborn | last post by:
Hi All, I have a dillema that I created 2 transaction file before I started to take log back. Now I changed my recovery model from simple to full. Do I still need to keep my second transaction...
1
by: bay_dar | last post by:
It seems there has got to be a better way to work with log files where I want to keep 8 days of logs. For instance if I wanted to keep 80 days, this would be a horrible approach. How can I make...
7
by: indiarocks | last post by:
Just a basic question, I want to create a standard log file API and want that API to be shared by all my other python files. For eg. I have file1 which creates a file handle and hands it over to...
6
by: KG | last post by:
Hi, Does anyone knows how to recover the test file db2diag.log. By mistake I have delete the contents of db2diag.log, wondering if I could restore the contents of my db2diag.log.
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi all, Can somebody give me a hint why my custom install action does not register event log sources, when I run the MSI package generated by VS2005. The same install action DLL executed via...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.