mechanize

Interact with Flash using Python Mechanize

妖精的绣舞 提交于 2020-01-13 19:17:08
问题 I am trying to create an automated program in Python that deals with Flash. Right now I am using Python Mechanize, which is great for filling forms, but when it comes to flash I don't know what to do. Does anyone know how I can interact with flash forms (set and get variables, click buttons, etc.) via Python mechanize or some other python library? 回答1: Nice question but seems unfortunately mechanize can't be used for flash objects 回答2: What you probably want to search for is how to control

Is there a tool like mechanize for Android? [closed]

删除回忆录丶 提交于 2020-01-13 09:58:41
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I'm creating an Android app which must do some web surfing in the background in order to provide a service to the user. The site I must connect to has no API, it only provides standard HTTP access, with extensive cookie usage but (luckily for me) not much Javascript code. I wonder if there is a library which

How to save mechanize.Browser() cookies to file?

和自甴很熟 提交于 2020-01-13 04:40:25
问题 How could I make Python's module mechanize (specifically mechanize.Browser()) to save its current cookies to a human-readable file? Also, how would I go about uploading that cookie to a web page with it? Thanks 回答1: Deusdies,I just figured out a way with refrence to Mykola Kharechko's post #to save cookie >>>cookiefile=open('cookie','w') >>>cookiestr='' >>>for c in br._ua_handlers['_cookies'].cookiejar: >>> cookiestr+=c.name+'='+c.value+';' >>>cookiefile.write(cookiestr) #binding this cookie

Python, Mechanize - request disallowed by robots.txt even after set_handle_robots and add_headers

匆匆过客 提交于 2020-01-11 10:01:09
问题 I have made a web crawler which gets all links till the 1st level of page and from them it gets all link and text plus imagelinks and alt. here is whole code: import urllib import re import time from threading import Thread import MySQLdb import mechanize import readability from bs4 import BeautifulSoup from readability.readability import Document import urlparse url = ["http://sparkbrowser.com"] i=0 while i<len(url): counterArray = [0] levelLinks = [] linkText = ["homepage"] levelLinks = []

How to login to a website with python and mechanize

浪子不回头ぞ 提交于 2020-01-10 07:22:44
问题 i'm trying to log in to the website http://www.magickartenmarkt.de and do some analyzing in the member-area (https://www.magickartenmarkt.de/?mainPage=showWants). I saw other examples for this, but i don't get why my approaches didn't work. I identified the right forms for the first approach, but it's not clear if it worked. In the second approach the returing webpage shows me that i don't have access to the member area. I would by glad for any help. import urllib2 import cookielib import

Using selenium-webdriver for parsing (Ruby)

我的梦境 提交于 2020-01-07 03:34:12
问题 Previously I used mechanize for parsing, but now I'm parsing website that uses javscript and mechanize doesn't support it, so I took selenium. I have to take information about companies from this website but I can get the information only after click on javascript link. I did it with selenium, my parser clicks on javascript, then collects information and here appear problems. As you understand I need to save collected information to the database and I can do this properly only if information

Python autologin using mechanize

。_饼干妹妹 提交于 2020-01-06 08:15:44
问题 FIXED! updated with working code I have been going about trying to make this auto login thing working for me. Do note I'm still a Python novice at this point. The following is the html code I found when I inspected the relevant form: <form action="/cgi-bin/netlogin.pl" method="post" name="netlogin"> <tr> <td><div align="right">Intranet userid:</div></td> <td><input type="text" size="20" maxlength="50" name="uid" id="uid" class="formField" /></td> </tr> <tr> <td><div align="right">Wachtwoord:<

can mechanize read ajax? (ruby)

巧了我就是萌 提交于 2020-01-05 17:36:35
问题 can I get the correct data/text that is displayed via AJAX using mechanize in ruby? Or is there any other scripting gem that would allow me to do so? 回答1: Mechanized cannot read data displayed by JavaScript, because it does not implement a JavaScript engine (in other words, it can't run it). You'll need a browser to do that, or a program that automates a browser to do it for you. WATIR is one such program. 回答2: You can use WATIR with webdriver which is a console only, headless browser. 来源:

Python Mechanize Submit Button on NIH Website

倖福魔咒の 提交于 2020-01-05 12:01:28
问题 I'm using mechanize on python 2.7.3. I'm looking for help on hitting the submit button on NIH's gene website. The button is an actual button element surrounded by divs and not inside any form field. <button id="search" type="submit" class="button_search nowrap" cmd="go">Search</button> So far in examples and what I've seen online, submit buttons usually have a name or a label which mechanize can select for, or are in a form so I can do br.submit(). How would I hit submit on this one? Thanks

BeautifulSoup not extracting all html

只谈情不闲聊 提交于 2020-01-04 06:26:14
问题 We are trying to get product urls from this page of Forever 21's site (http://www.forever21.com/Product/Category.aspx?br=f21&category=dress&pagesize=100&page=1). For some reason, BeautifulSoup is not getting the elements with class "item_pic", even though they are in the site html. We have tried using requests, mechanize, selenium, and are having no luck. All the commented code is from previous attempts to get the html (none of which worked). Here is our code: from bs4 import BeautifulSoup