Help regarding urllib
Hello All, I am simply fetching data from robots.txt of a url. Below is my code. siteurl = siteurl.rstrip("/") -- http://mail.python.org/mailman/listinfo/python-list
Re: Help regarding urllib
On Saturday, August 24, 2013 4:15:01 PM UTC+5:30, malhar vora wrote: > Hello All, > > > > > > I am simply fetching data from robots.txt of a url. Below is my code. > > > > siteurl = siteurl.rstrip("/") Sorry for last complete. It was sent by mistake. Here is my code. siteurl = siteurl.rstrip("/") roboturl = siteurl + r'/robots.txt' robotdata = urllib.urlopen(roboturl).read() # Reading robots.txt of given url print robotdata In above code siteurl is fetched simply from local text file. Whenever I run above code. In place of "/" before robots.txt, it writes "\\" in url as I found in error. The error is given below. This is main function Main URL : www.bestrecipes.com.au $$:www.bestrecipes.com.au ###-->www.bestrecipes.com.au/robots.txt Traceback (most recent call last): File "dataintegrator.py", line 104, in main() File "dataintegrator.py", line 81, in main print "Sitemap Url : " + getSiteMapUrl(i) File "D:\Malhar Data\Projects\Data Parsing\My Code\Final Part\libs\datareader. py", line 50, in getSiteMapUrl robotdata = urllib.urlopen(roboturl).read() # Reading robots.txt of given ur l File "C:\Python26\lib\urllib.py", line 87, in urlopen return opener.open(url) File "C:\Python26\lib\urllib.py", line 203, in open return getattr(self, name)(url) File "C:\Python26\lib\urllib.py", line 461, in open_file return self.open_local_file(url) File "C:\Python26\lib\urllib.py", line 475, in open_local_file raise IOError(e.errno, e.strerror, e.filename) IOError: [Errno 2] The system cannot find the path specified: 'www.bestrecipes.c om.au\\robots.txt' I am new to Python and not able to figure out this problem. Please help me. Thank you, Malhar Vora -- http://mail.python.org/mailman/listinfo/python-list
Help regarding python facepy library
Hello all, I am using python facepy library to fetch data from facebook. It was running fine. The problem now is I just changed my system and now getting error that says "certificate verify failed". Here my code and exception log both are given below. The library that I have used is https://pypi.python.org/pypi/facepy Code is given below. # import facepy from facepy import GraphAPI,exceptions import json graph = GraphAPI('my fb access token') fb_dump = open('D:\\Malhar Data\\Projects\\Social Media Web Project\\TestGround\\temp\\Output\\output.txt', 'w') try: pages = graph.get('AhmedabadUniversity/posts', page=True) all_pages = [] for page in pages: all_pages = all_pages + page["data"] except exceptions.OAuthError, error: if error.code == 2: print "Unexpected error occured" elif error.code == 803: print "Alias or Page does not exist" for d in all_pages: fb_dump.write("Message : " + d.get('message','None').encode("UTF-8", "ignore")) fb_dump.close() ## Exception log is given below. D:\Malhar Data\Projects\Social Media Web Project\TestGround\temp>python fbgrabbe r.py C:\Python26\lib\site-packages\facepy\graph_api.py:199: DeprecationWarning: BaseE xception.message has been deprecated as of Python 2.6 raise HTTPError(exception.message) Traceback (most recent call last): File "fbgrabber.py", line 14, in for page in pages: File "C:\Python26\Lib\site-packages\facepy\graph_api.py", line 212, in paginat e result, url = load(method, url, data) File "C:\Python26\Lib\site-packages\facepy\graph_api.py", line 199, in load raise HTTPError(exception.message) facepy.exceptions.HTTPError: [Errno 1] _ssl.c:480: error:14090086:SSL routines:S SL3_GET_SERVER_CERTIFICATE:certificate verify failed I tried generating new token and run the script but got same error. I didn't find any solution of this problem. If anybody is able to figure out the problem, please help me. Thank you, Malhar Vora -- https://mail.python.org/mailman/listinfo/python-list