Newbie question. I created a class:
class WP(seleniumrequests.PhantomJS):
def __init__(self, wpurl='https://blah.org/download/release-archive/', bwppurl='https://blah.org/plugins/browse/popular/'):
self.wp=wpurl
self.bwpp=bwppurl
def wpscaper(self):
wpjfetch=seleniumrequests.PhantomJS('../ms-tuesday/phantomjs/bin/phantomjs')
wpjfetch.get(self.wp)
wpsoup=BeautifulSoup(wpjfetch.page_source, 'lxml')
def wppscaper(self):
wppjfetch=seleniumrequests.PhantomJS('../ms-tuesday/phantomjs/bin/phantomjs')
wppjfetch.get(self.bwpp)
wppsoup=BeautifulSoup(wpjfetch.page_source, 'lxml')
I am trying to understand why I cannot see any of my methods in where I would expect it to be:
goodies=WP()
goodies.wpscaper()
goodies.wpscaper.wpjfetch.page_source
goodies.wpscaper.wpsoup
What I see is:
goodies.wpscaper.im_class goodies.wpscaper.im_func goodies.wpscaper.im_self
and the same applies for:
goodies=WP()
goodies.wppscaper()
goodies.wppscaper.im_class goodies.wppscaper.im_func goodies.wppscaper.im_self
What gives ??
---------- Post updated 08-26-15 at 03:35 PM ---------- Previous update was 08-25-15 at 05:37 PM ----------
I can see that the stuff works. For example, if I add a print statement to the functions such as:
class WP(seleniumrequests.PhantomJS):
def __init__(self, wpurl='https://blah.org/download/release-archive/', bwppurl='https://blah.org/plugins/browse/popular/'):
self.wp=wpurl
self.bwpp=bwppurl
def wpscaper(self):
wpjfetch=seleniumrequests.PhantomJS('../ms-tuesday/phantomjs/bin/phantomjs')
wpjfetch.get(self.wp)
wpsoup=BeautifulSoup(wpjfetch.page_source, 'lxml')
print (wpsoup)
def wppscaper(self):
wppjfetch=seleniumrequests.PhantomJS('../ms-tuesday/phantomjs/bin/phantomjs')
wppjfetch.get(self.bwpp)
wppsoup=BeautifulSoup(wpjfetch.page_source, 'lxml')
print (wppsoup)
it prints exactly whats in wpsoup or wppsoup:
goodies=WP()
goodies.wpscaper()
<!DOCTYPE html>
<html dir="ltr" lang="en" xmlns="http://www.w3.org/1999/xhtml"><head profile="http://gmpg.org/xfn/11">
<meta charset="utf-8"/>
<!--
<meta property="fb:page_id" content="6427302910" />
-->
<meta content="7VWES_-rcHBcmaQis9mSYamPfNwE03f4vyTj4pfuAw0" name="google-site-verification"/>
blah blah blah blah..
goodies.wppscaper()
<!DOCTYPE html>
<html dir="ltr" lang="en" xmlns="http://www.w3.org/1999/xhtml"><head profile="http://gmpg.org/xfn/11">
<meta charset="utf-8"/>
<!--
<meta property="fb:page_id" content="6427302910" />
-->
<meta content="7VWES_-rcHBcmaQis9mSYamPfNwE03f4vyTj4pfuAw0" name="google-site-verification"/>
blah blah blah blah..
Additonal Info:
In [180]: dir(goodies.wpscaper)
Out[180]:
['__call__',
'__class__',
'__cmp__',
'__delattr__',
'__doc__',
'__format__',
'__func__',
'__get__',
'__getattribute__',
'__hash__',
'__init__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__self__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'im_class',
'im_func',
'im_self']
In [181]: dir(goodies.wppscaper)
Out[181]:
['__call__',
'__class__',
'__cmp__',
'__delattr__',
'__doc__',
'__format__',
'__func__',
'__get__',
'__getattribute__',
'__hash__',
'__init__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__self__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'im_class',
'im_func',
'im_self']
So I simple cant understand why I dont have access to:
goodies.wpscaper.wpjfetch
goodies.wpscaper.wpsoup
or
goodies.wppscaper.wppjfetch
goodies.wppscaper.wppsoup
why cant I see them?? I am truly confused.