简体   繁体   English

使用浏览器认证的凭据通过python mechanize从用户帐户中抓取数据

[英]Use browser authenticated credentials to scrape data from user account using python mechanize

I have build a web scraper for amazon user accounts using python with mechanize, beautifulsoup modules. 我使用带有机械化,Beautifulsoup模块的python为亚马逊用户帐户构建了一个网络抓取工具。 The idea was to login via mechanize and parse the webpage using beautifulsoup which works successful for my account. 我的想法是通过机械化登录并使用beautifulsoup解析网页,该方法对我的帐户成功。 i want to open this program as a web application and allow others to login using their amazon account and get useful information about their account. 我想将此程序作为Web应用程序打开,并允许其他人使用其亚马逊帐户登录并获取有关其帐户的有用信息。

The problem i have is that no one will trust my web application enough to provide their amazon credentials directly. 我的问题是,没有人会足够信任我的Web应用程序以直接提供其亚马逊凭据。 Amazon doesnt provide(or atleast i couldnt find it) any other means to authenticate users. 亚马逊不提供(或至少我找不到)任何其他方式来验证用户身份。 so I was wondering if their are other ways to let users authenticate via my web app. 所以我想知道他们是否还有其他方法可以让用户通过我的Web应用程序进行身份验证。 The things i thought are as follows 1) Allow users to login via browser(chrome,firefox) and fetch the cookie which can then be used by my webapp. 我认为的事情如下:1)允许用户通过浏览器(chrome,firefox)登录并获取cookie,然后供我的webapp使用。 2) use mechanize to get credentials and then pass it over my webapp 2)使用机械化获取凭据,然后将其通过我的webapp

I have no clue how both of them can be accomplished using python. 我不知道如何使用python来完成它们。 Anyone has a rough idea how to do it. 任何人都有一个大概的想法。 I have already tried using pycookiecheat module for chrome which doesnt work for all OSes. 我已经尝试对chrome使用pycookiecheat模块,但不适用于所有操作系统。 any other brainstorming ideas much appreciated? 还有其他集思广益的想法很受赞赏吗?

Unfortunately it looks like Amazon has taken some measures to prevent automated login - at least all my mechanize scripts (both python and perl) are no longer working. 不幸的是,亚马逊似乎采取了一些措施来防止自动登录-至少我所有的机械化脚本(python和perl)都不再起作用。

Therefore from my point of view the best approach is to let the user login and store credentials locally on their devices. 因此,从我的角度来看,最好的方法是让用户登录并将凭据本地存储在其设备上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM