Troy Brewer

msg tools
Don't hover over me!
Don't hover over me!
Someone was lamenting the tediousness of adding items to a geeklist. I created this script to sort of ease that. Below is the script. It takes 5 inputs (Username, Password, geeklist ID, Geek Item ID, and Comment. It only posts to an existing geeklist right now and I have a script that will create a geeklist, but I haven't merged them yet. Also, you have to know the geek item ID, but that is easy to look up. I had fun writing this and thought someone might find it useful. If anyone has any suggestions or requests please feel free to contact me and I will try to help as best I can.

import urllib2,cookielib,urllib
#cookie jar for holding session cookies
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('User-agent', 'RedditTesting')]
def add_geeklist_item(user,passwd,glid,giid,comment):
#login to site
login_url =""
login_data={'username': user, 'password': passwd, 'B1': 'Submit'}
loginrequest = urllib2.Request(login_url,data)
loginresponse= urllib2.urlopen(loginrequest)
response = [None]
# add headers to request. Some of these may not be necessary, but they are what was sent via fiddler.
req = urllib2.Request("")
req.add_header("X-Requested-With", "XMLHttpRequest")
req.add_header("Accept", "text/javascript, text/html, application/xml, text/xml, */*")
req.add_header("Content-type", "application/x-www-form-urlencoded; charset=utf-8")
req.add_header("Accept-Language", "en-US")
req.add_header("Accept-Encoding", "gzip, deflate")
req.add_header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko")
req.add_header("Connection", "Keep-Alive")
req.add_header("Pragma", "no-cache")
#replace spaces with %20 so that the post functions as expected
comment= comment.replace(" ","%20")
#define the body of the post.
body = "action=save&listid={geeklistID}&itemid=0&objectid={geekItemID}&objecttype=thing&B2=Save&B2=Cancel&comments={cmnt}&B1=Save&hideheader=1&ajax=1".format(geeklistID=glid,geekItemID=giid,cmnt=comment)
response[0] = urllib2.urlopen(req, body)
#Examples of use
add_geeklist_item("mad4hatter","hunter2",216654,1,"Allison Test")

add_geeklist_item("mad4hatter","hunter2",216654,2,"Allison Test")
add_geeklist_item("WhoDislikesKittens","hunter2",216654,5307,"I got your number")
add_geeklist_item("mad4hatter","hunter2",216654,3,"!!MONKEYS ")
#You can have things be bold as well. The regular bgg formatting applies. \n for new lines
add_geeklist_item("WhoDislikesKittens","hunter2",216704,867,"not bold\n not bold \nBOLD")
 Thumb up
  • [+] Dice rolls
Front Page | Welcome | Contact | Privacy Policy | Terms of Service | Advertise | Support BGG | Feeds RSS
Geekdo, BoardGameGeek, the Geekdo logo, and the BoardGameGeek logo are trademarks of BoardGameGeek, LLC.