leitel
12-26-2010, 09:00 PM
I am in process of upgrading from vb 3.8 to 4.1. I use a combination of python and bash scripting to automate certain processes.
I am currently exploring the possibility to delete a batch of some 20 products from a 3.8 site.
Here is the query string to delete a product:
http://www.noblood.org/admincp/plugin.php?do=productdelete&productid=smdtls
The following is a stub of some python code to accomplish this:
import urllib, urllib2
params = urllib.urlencode(dict(username='xxxx', password='xxx'))
f = urllib2.urlopen('http://www.noblood.org/signin/', params)
data = f.read()
f.close()
params = urllib.urlencode(dict(do='productkill', productid='mdtls', adminhash='f7a0a98b5501789998d73cb5f3a73721', securitytoken='1293402559-c23e84804', id='submit0'))
f = urllib2.urlopen('http://www.noblood.org/admincp/plugin.php?do=productkill/', params)
data = f.read()
f.close()
This code does not work. Does anyone with python experience know how to login to vB via python and then access protected pages for purpose in this case to post requests to individually delete a batch of products?
It involves working with cookie and perhaps the securitytoken.
Thank you :)
I am currently exploring the possibility to delete a batch of some 20 products from a 3.8 site.
Here is the query string to delete a product:
http://www.noblood.org/admincp/plugin.php?do=productdelete&productid=smdtls
The following is a stub of some python code to accomplish this:
import urllib, urllib2
params = urllib.urlencode(dict(username='xxxx', password='xxx'))
f = urllib2.urlopen('http://www.noblood.org/signin/', params)
data = f.read()
f.close()
params = urllib.urlencode(dict(do='productkill', productid='mdtls', adminhash='f7a0a98b5501789998d73cb5f3a73721', securitytoken='1293402559-c23e84804', id='submit0'))
f = urllib2.urlopen('http://www.noblood.org/admincp/plugin.php?do=productkill/', params)
data = f.read()
f.close()
This code does not work. Does anyone with python experience know how to login to vB via python and then access protected pages for purpose in this case to post requests to individually delete a batch of products?
It involves working with cookie and perhaps the securitytoken.
Thank you :)