adminset 打开http://192.168.137.4:9000 跳转到/navi

adminset 打开http://192.168.137.4:9000 跳转到/navi_第1张图片

1. 程序主的url入口:

[root@adminset adminset]# cat urls.py
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from adminset.views import index

urlpatterns = [
    url(r'^$', index,name='index'),
	
	
http://192.168.137.4:9000  会访问adminset.views的index 方法

[root@adminset adminset]# cat views.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-

from django.shortcuts import redirect


def index(request):
    return redirect('/navi/')
	

# !/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import urllib
import cookielib
import json
import httplib
import re
import requests
from lxml import etree
import StringIO

s = requests.session()
print s.headers
url = "https://licai.yingyinglicai.com/user/login.htm"
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0'
}

url = 'http://192.168.137.4:9000/'
r = s.get(url, headers=headers)

print '---------------------------------------------------------------------------------------------------------'
print r.headers
x=r.headers
print r.content

print x
print type(x)
for i in x:
 print i+'->'+x[i]
 
 C:\Python27\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.5\helpers\pycharm\_jb_unittest_runner.py" --path D:/adminset/httprequest/testlocation.py
Testing started at 10:37 ...
Launching unittests with arguments python -m unittest discover -s D:/adminset/httprequest -p testlocation.py -t D:\adminset\httprequest in D:\adminset\httprequest
{'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'User-Agent': 'python-requests/2.18.4'}
---------------------------------------------------------------------------------------------------------
{'Content-Length': '4101', 'Set-Cookie': 'csrftoken=c52zVVgBuTNStkEEU9Bg0gdxxrAuWU1D0Wtkx0eBkxNBn6cnSZlZtlzLGC2lhG7y; expires=Fri, 08-Nov-2019 16:33:47 GMT; Max-Age=31449600; Path=/', 'Vary': 'Cookie', 'Server': 'WSGIServer/0.1 Python/2.7.15', 'Date': 'Fri, 09 Nov 2018 16:33:47 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'text/html; charset=utf-8'}



  
  
  AdminSet Login
  
  
      
  
  
  
  
  
  
  

  
  
    









    
        
        
    


  
  
  











{'Content-Length': '4101', 'Set-Cookie': 'csrftoken=c52zVVgBuTNStkEEU9Bg0gdxxrAuWU1D0Wtkx0eBkxNBn6cnSZlZtlzLGC2lhG7y; expires=Fri, 08-Nov-2019 16:33:47 GMT; Max-Age=31449600; Path=/', 'Vary': 'Cookie', 'Server': 'WSGIServer/0.1 Python/2.7.15', 'Date': 'Fri, 09 Nov 2018 16:33:47 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'text/html; charset=utf-8'}

Date->Fri, 09 Nov 2018 16:33:47 GMT
Server->WSGIServer/0.1 Python/2.7.15
Vary->Cookie
X-Frame-Options->SAMEORIGIN
Content-Type->text/html; charset=utf-8
Content-Length->4101
Set-Cookie->csrftoken=c52zVVgBuTNStkEEU9Bg0gdxxrAuWU1D0Wtkx0eBkxNBn6cnSZlZtlzLGC2lhG7y; expires=Fri, 08-Nov-2019 16:33:47 GMT; Max-Age=31449600; Path=/


Ran 0 tests in 0.000s

OK

Process finished with exit code 0
Empty test suite.

 

你可能感兴趣的:(cmdb(adminset))