robobrowser

How to return html of a page using robobrowser

陌路散爱 提交于 2019-12-30 18:50:39
问题 I'm experimenting with http://robobrowser.readthedocs.org/en/latest/readme.html, a new python library based on the beautiful soup library. I'm trying to test it out by opening an html page and returning it within a django app, but I can't figure out to do this most simple task. My django app contains : def index(request): p=str(request.POST.get('p', False)) # p='https://www.yahoo.com/' browser = RoboBrowser(history=True) postedmessage = browser.open(p) return HttpResponse(postedmessage) How

python, authentication not recognised - urllib2, requests, asp.net

痴心易碎 提交于 2019-12-25 03:11:46
问题 Though I'm not particularly advanced at any of this, I've had some past success in using urrlib2, requests and scrapy but this has me stumped. So after much searching and banging my head against the keyboard, I'll just go ahead and ask. I'd like to get the html source code of a site but after using my username and password, I keep getting a page thrown back which says my username and password are wrong. They work fine in the browser, and once logged in the source code is readily available

Setting a plain checkbox with robobrowser

空扰寡人 提交于 2019-12-22 00:27:27
问题 I am struggling to check a simple checkbox with robobrowser to discard all messages in mailman. form['discardalldefersp'].options returns ['0'] , neither form['discardalldefersp'].value= True nor form['discardalldefersp'].value = '1' delivers a result. I only get 'ValueError: Option 1 not found in field ' How can I set the checkbox? My code for the whole thing is as following: import robobrowser pw = '<password>' browser = RoboBrowser(history=True) browser.open('<mailmanlist>') form = browser

how to remove AttributeError in Robobrowser

╄→尐↘猪︶ㄣ 提交于 2019-12-11 07:14:00
问题 i'm trying to login to my college id and fetch some info using robobrowser . bu i'm getting this traceback when i try to print contents of my dashboard. Traceback (most recent call last): File "C:/Users/User/PycharmProjects/dictionary/RobobrowseErp.py", line 26, in <module> print(open.parsed) AttributeError: 'NoneType' object has no attribute 'parsed' here is my code. from robobrowser import RoboBrowser import requests start = requests.session() token = 'value_of_token' token_1 = 'value_of

How to submit a form with a get action using Robobrowser

浪子不回头ぞ 提交于 2019-12-10 15:28:11
问题 I am using the robobrowser library, I have come across a form: <form action="/results" id="search"> <div class="s_ctr"> <fieldset> <label class="jaw" for="ln">Search by Name</label><input type="text" placeholder="Search by Name" autocomplete="off" value="" tabindex="1" name="ln" maxlength="255" class="name" id="ln" data-key="true"><span>near</span><label class="jaw" for="loc">Enter City, State</label><input type="text" placeholder="Enter City, State" autocomplete="off" value="" tabindex="2"

Combining RoboBrowser with Requests-HTML

风格不统一 提交于 2019-12-10 12:18:34
问题 I like the ease of filling out and submitting online forms using RoboBrowser and I think I understand how to access the requests.Session() instance underlying RoboBrowser if I need to use that. But I want to submit a form using RoboBrowser then pass the session to requests_html.Session() so I can render the HTML using JavaScript. How do I do that? Is there a way to convert a Requests session to a Requests-HTML session? I have looked through the documentation for Requests, Requests-HTML and

Different web site response with RoboBrowser

旧街凉风 提交于 2019-12-10 09:37:36
问题 I'm trying to retrieve the HTML for a web site. When I view the page in Chrome I see a form with dates and rate options. But when I request the site with RoboBrowser I see a short HTML response which is completely different. What I am doing wrong? My code: from robobrowser import RoboBrowser browser = RoboBrowser(parser='html.parser') browser.open('http://www.marriott.com/reservation/availabilitySearch.mi?propertyCode=ATLRZ') print(browser.parsed) Result: <!DOCTYPE doctype html> <html> <head>

Python can't find already installed module robobrowser

丶灬走出姿态 提交于 2019-12-08 06:27:51
问题 I am trying to create a very simple Python 3.6 script. Using MacOS. For this script I had to install robobrowser, which I installed with easy_install robobrowser . After that I try to import it with the following statements: import re from robobrowser import RoboBrowser However, terminal prompted me with the following (infamous) error: Traceback (most recent call last): File "signup.py", line 2, in <module> from robobrowser import RoboBrowser ModuleNotFoundError: No module named 'robobrowser'

How to make POST request in robobrowser-python

二次信任 提交于 2019-12-07 04:23:17
问题 http://robobrowser.readthedocs.org/en/latest/api.html I'm trying to hit an API using browser.open(myurl) and looking for a RB method similar to requests.post(url,data=data) . since robobrowser built on the top of requests and beautifulsoup so I think there must be a way to do so. 回答1: You can re-use the requests.Session() object of a RoboBrowser object to do your own POST s with the same cookies: response = browser.session.post(...) The RoboBrowser state won't be updated though; you'd have to

Different web site response with RoboBrowser

戏子无情 提交于 2019-12-05 23:02:00
I'm trying to retrieve the HTML for a web site. When I view the page in Chrome I see a form with dates and rate options. But when I request the site with RoboBrowser I see a short HTML response which is completely different. What I am doing wrong? My code: from robobrowser import RoboBrowser browser = RoboBrowser(parser='html.parser') browser.open('http://www.marriott.com/reservation/availabilitySearch.mi?propertyCode=ATLRZ') print(browser.parsed) Result: <!DOCTYPE doctype html> <html> <head><script src="/common/js/marriottCommon.js" type="text/javascript"> </script> <meta charset="utf-8"> <