New config.py File:
1. Analysis of Friends of the league website login
predata={
"token": "7e63b6d788d9a9fa8478646a508bd44c",
"username": "User name",
"Password": "Password",
"SIG": "",
"SessionID": "",
"Website": "Umengplus",
"app_id": "Cnzz",
"url": "Https://web.umeng.com/main.php?c=site&a=show&from=login"
}
headers={
": Authority": "I.umeng.com",
": Method": "POST",
":p ath": "/login/ajax_do",
": Scheme": "https",
"Accept": "*/*",
"Accept-encoding": "gzip, deflate",
"Accept-language": "zh-cn,zh;q=0.8",
"Content-length": "200",
"Content-type": "application/x-www-form-urlencoded; Charset=utf-8 ",
"Cookie": "PHPSESSID=7ORDMLJTQNN5KHDKV0EOFF9F85; cn_ea1523f470091651998a_dplus=%7b%22distinct_id%22%3a%20% 2215ad491eefd30b-05c8ec563-424e002e-13c680-15ad491eefff6%22%2c%22%24_sessionid%22%3a%200%2c%22%24_sessiontime% 22%3a%201489625019%2c%22%24dp%22%3a%200%2c%22%24_sessionpvtime%22%3a%201489625019%7d; _uab_collina=148962502090448104944825; cn_a61627694930aa9c80cf_dplus=%7b%22distinct_id%22%3a%20% 2215ad491eefd30b-05c8ec563-424e002e-13c680-15ad491eefff6%22%7d; Um_distinctid=15ad491eefd30b-05c8ec563-424e002e-13c680-15ad491eefff6; cnzzdata1258498910=326642109-1489621238-null%7c1489621238; umpluscenter=3058a47b577f1e4344d42b6a47e1da910bfbb32c; CNA=/XBQEAOVVRUCAXVHNS5UBFPE; l=ahoaszt4heblhjd2dquuvhfq6so9k54m; Isg=ajex7blizqlglwedxem6peluql2spgcfgl1rahnh9fguolkmwwxlygocknmm ",
"Origin": "https://i.umeng.com",
"Referer": "Https://i.umeng.com/?app_id=cnzz&redirectURL=https%3A%2F%2Fweb.umeng.com%2Fmain.php%3Fc%3Dsite% 26a%3dshow%26from%3dlogin ",
"User-agent": "mozilla/5.0 (Windows NT 6.1; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/47.0.2526.106 safari/537.36 ",
"X-requested-with": "XMLHttpRequest"
}
2. Analyze My Site
Add the following in config.py:
Url_list= ' Https://web.umeng.com/main.php?c=site&a=show&ajax=module=list|module=isOpenTongji&search =¤tpage=1&pagetype=30&sort=0 '
New cnzz_resource_resource.py Script
Import JSON
Import requests
Import OS
Import time
Import datetime
From Pymongo import mongoclient
Import Config
Import Traceback
Import Random
Import Sys
Reload (SYS)
Sys.setdefaultencoding ("Utf-8")
Class Cnzzcatch:
def __init__ (self):
self.site_id = ' '
Self.name = ' '
self.config = Config
Self.dbclient = mongoclient (' 192.168.86.126 ', 27017)
Self.pre_day = ' '
Self.sites=[]
Self.s=requests. Session ()
Self.__init_login ()
def __init_login (self):
Try
Self.s.post (Self.config.loginurl,data=self.config.predata,headers=self.config.headers)
Time.sleep (Random.random ())
R = Json.loads (Self.s.get (self.config.url_list). Content)
Print R
For temp in r[' data ' [' list '] [' Items ']:
If Isinstance (temp,dict):
Self.sites.append ({"SiteID": temp["SiteID"], "name": temp["Name"})
Except
Traceback.print_exc ()
if __name__ = = ' __main__ ':
x = Cnzzcatch ()
X.run ()
X.close ()
Python simulates landing a friend's website and getting information about my Site