On 1/29/2014 8:59 PM, scurvy scott wrote:
Please always reply to the tutor list so we can all play with your question.
On 1/28/2014 9:12 PM, scurvy scott wrote:
Hi guys, I'm trying to figure out why my code won't output to
terminal, but will run just fine in interpreter.
I'm using python 2.7.3 on Debian Linux/Crunchbang.
Here is my code.
import requests
from bs4 import BeautifulSoup as beautiful
import sys
def dogeScrape(username, password):
payload = {'username': username, 'password': password}
r = requests.post("http://dogehouse.org/index.php?page=login",
data=payload)
soup = beautiful(r.text)
confirmed = str(soup.findAll('span',{'class':'confirmed'}))
print "Confirmed account balance: " + confirmed[86:98]
dogeScrape("XXXX", "XXXX")
It will output the "confirmed....." part, just not the confirmed
variable. It will output the entire thing in the interpreter.
I am stuck at "import requests". Where did you get that module?
My guess is that you are getting a different response from the server. I
suggest you write the entire response text to a file, then edit it
looking for 'class="confirmed"'.
I signed up at Dogehouse. What the heck is it? There is no explanation
as to what it does or what I'd do with it!
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor