url

How to redirect to external URL in Django?

徘徊边缘 提交于 2020-01-23 04:45:11
问题 I think this should be easy, but I cannot figure it out. I am trying to write an opt-out view. I am receiving a get request. Through urls.py, I render my opt-out view. In this view, I save some parameters for the user in the database and then I want to redirect the user to an external URL. I tried: return redirect('http://stackoverflow.com/') from Django documentation. However, the optout view renders the training template instead of returning the redirect, though the parameters are saved in

Prevent URL-encoding of characters in link in MediaWiki

假装没事ソ 提交于 2020-01-23 04:12:27
问题 I.e.: How to suppress substitution/replacement of characters with its html entities in a MediaWiki link? I need to insert a link looking like this, pipes ( | ) included, into a MediaWiki article: http://www.somesite.asdf/#|param1|param2|param3 The target site does not accept %7C or | as pipe-substitutes in its URL. Ergo, the following URLs are invalid: http://www.somesite.asdf/#%7Cparam1%7Cparam2%7Cparam3 http://www.somesite.asdf/#|param1|param2|param3 When I type the link into the MediaWiki

Prevent URL-encoding of characters in link in MediaWiki

这一生的挚爱 提交于 2020-01-23 04:12:24
问题 I.e.: How to suppress substitution/replacement of characters with its html entities in a MediaWiki link? I need to insert a link looking like this, pipes ( | ) included, into a MediaWiki article: http://www.somesite.asdf/#|param1|param2|param3 The target site does not accept %7C or | as pipe-substitutes in its URL. Ergo, the following URLs are invalid: http://www.somesite.asdf/#%7Cparam1%7Cparam2%7Cparam3 http://www.somesite.asdf/#|param1|param2|param3 When I type the link into the MediaWiki

从后端到前端之Vue(五)小试路由

自作多情 提交于 2020-01-23 02:11:33
  一开始我还以为vue的路由只能用在工程化的项目里面呢,然后研究了一下才发现,在脚本化里面也是可以用的。其实呢不管在哪里用,把原理研究明白就对了。 一、 官网demo   这里不得不吐槽一下官网,写的不清不楚的,在哪里使用都没有说清楚,几行代码一句话就轻飘飘的交代完事了,剩下的事情还得自己研究,比如 HTML5 History API 是怎么回事。这里又涉及了一个问题,想要用好vue,必须的基础是要先掌握的,因为vue的官网教程里面不会管这些基础知识的。   先看官网的代码: 1 const NotFound = { template: '<p>Page not found</p>' } 2 const Home = { template: '<p>home page</p>' } 3 const About = { template: '<p>about page</p>' } 4 5 const routes = { 6 '/': Home, 7 '/about': About 8 } 9 10 new Vue({ 11 el: '#app', 12 data: { 13 currentRoute: window.location.pathname 14 }, 15 computed: { 16 ViewComponent () { 17 return routes[this

php CI框架目录结构及运行机制

筅森魡賤 提交于 2020-01-23 01:03:26
CI目录结构 CI主要组成部分为,application(应用文件夹)、system(系统文件夹)和index.php入口文件。 应用文件夹中主要是存放控制器、模型和视图等,系统文件夹中主要是存放组成CI的核心文件的,index.php入口文件是一个单一入口文件,所谓单一文 件是指在一个网站(应用程序)中,所有的请求都是指向的这么一个文件,由它负责接收并处理URL中的控制器和方法。换句话说, 它调用一个 '控制器', 然后返回一个'视图'。 application : cache 第一次安装时为空,如果你打开缓存设置,这个目录存放缓存数据 config 存放配置文件,包含网站的基本配置信息 controllers 存放你项目的控制器目录 core 该目录可以扩展系统的核心文件 errors 包含出错信息页,你不必修改这个目录 hooks 首次安装时为空,用来存放你创建的钩子。钩子是 用来装载其它文件的控制方法 helpers 辅助函数,你可以对系统的辅助函数进行扩展 language 存放你本国语言的文件目录 libraries 类库,你可以创建自己的类库 logs 如果你设置打开了系统的错误日志,日志文件就默认保存在这个目录 models 存放你项目的模型目录 views 存放视图的模板目录 system : core 存放系统核心文件 database

PHP CI框架目录结构及运行机制

99封情书 提交于 2020-01-23 01:02:44
CI目录结构 CI主要组成部分为,application(应用文件夹)、system(系统文件夹)和index.php入口文件。 应用文件夹中主要是存放控制器、模型和视图等,系统文件夹中主要是存放组成CI的核心文件的,index.php入口文件是一个单一入口文件,所谓单一文件是指在一个网站(应用程序)中,所有的请求都是指向的这么一个文件,由它负责接收并处理URL中的控制器和方法。换句话说, 它调用一个 '控制器', 然后返回一个'视图'。 application : cache 第一次安装时为空,如果你打开缓存设置,这个目录存放缓存数据 config 存放配置文件,包含网站的基本配置信息 controllers 存放你项目的控制器目录 core 该目录可以扩展系统的核心文件 errors 包含出错信息页,你不必修改这个目录 hooks 首次安装时为空,用来存放你创建的钩子。钩子是 用来装载其它文件的控制方法 helpers 辅助函数,你可以对系统的辅助函数进行扩展 language 存放你本国语言的文件目录 libraries 类库,你可以创建自己的类库 logs 如果你设置打开了系统的错误日志,日志文件就默认保存在这个目录 models 存放你项目的模型目录 views 存放视图的模板目录 system : core 存放系统核心文件 database

爬虫学习 04.Python网络爬虫之requests模块(1)

笑着哭i 提交于 2020-01-23 00:43:35
爬虫学习 04.Python网络爬虫之requests模块(1) 引入 Requests 唯一的一个 非转基因 的 Python HTTP 库,人类可以安全享用。 警告 :非专业使用其他 HTTP 库会导致危险的副作用,包括:安全缺陷症、冗余代码症、重新发明轮子症、啃文档症、抑郁、头疼、甚至死亡。 今日概要 基于requests的get请求 基于requests模块的post请求 基于requests模块ajax的get请求 基于requests模块ajax的post请求 综合项目练习:爬取国家药品监督管理总局中基于中华人民共和国化妆品生产许可证相关数据 知识点回顾 常见的请求头 常见的相应头 https协议的加密方式 今日详情 - 基于如下5点展开requests模块的学习 什么是requests模块 requests模块是python中原生的基于网络请求的模块,其主要作用是用来模拟浏览器发起请求。功能强大,用法简洁高效。在爬虫领域中占据着半壁江山的地位。 为什么要使用requests模块 因为在使用urllib模块的时候,会有诸多不便之处,总结如下: 手动处理url编码 手动处理post请求参数 处理cookie和代理操作繁琐 … 使用requests模块: 自动处理url编码 自动处理post请求参数 简化cookie和代理操作 … 如何使用requests模块 安装:

Direct download link to OneDrive file?

依然范特西╮ 提交于 2020-01-22 23:03:46
问题 A OneDrive sharable link looks like this: https://1drv.ms/w/s!AqmFiI7maXrRgT7PGcK_7JyZlBco. How do I get the direct download link version of this? I know with a onedrive.live/redir?<...> link I can just replace the 'redir' with 'download', but how do I do that for a link that looks like the one above? Thanks. 回答1: If you follow the instruction here you can generate a URL that will act on the shared item, including being able to get its content. In your case the URL would look like https://api

python爬虫学习

拟墨画扇 提交于 2020-01-22 22:54:52
利用python爬虫实现在目标网页上爬取图片的功能。 爬取图片 爬虫代码 图形化界面 总结 爬取图片 要实现目标功能首先考虑的是要如何实现从网上爬取图片,通过在网上参考学习我选择通过引用python的requests和re、os模块实现爬虫。下面我简单介绍一下引用这三个模块的目的,有兴趣深入了解的话网上都能搜到相关的详尽的文章。 requests是使用Apache2 licensed 许可证的HTTP库,用python编写。比urllib2模块更简洁。Request支持HTTP连接保持和连接池,支持使用cookie保持会话,支持文件上传,支持自动响应内容的编码,支持国际化的URL和POST数据自动编码,在python内置模块的基础上进行了高度的封装,从而使得python进行网络请求时,变得人性化,使用Requests可以轻而易举的完成浏览器可有的任何操作。 python 中使用正则表达式需要引入re模块,正则表达式是用来匹配处理字符串的 。 需要查找操作文件,比如说查找配置文件(从而读取配置文件的信息),查找测试报告(从而发送测试报告邮件),要对大量文件和大量路径进行操作,这就依赖于os模块。 爬虫代码 引用需要的的模块。 #_*_coding:utf-8_*_ import requests import re import os 接下来我们定义一个爬虫类,用于从网页上爬取图片

How do you convert a url to a virtual path in asp.net without manual string parsing?

烈酒焚心 提交于 2020-01-22 20:09:20
问题 I've seen similar questions and answers regarding conversions from virtual to absolute and url, but how can I convert a url to a virtual path without manual string parsing? Example: I want "http://myserver/home.aspx" converted to: "~/home.aspx" I realize the above example would be an easy string parsing routine, but I'm looking for a proper solution that will scale to the changing of the url format. 回答1: You can get most of it from the Uri class: new Uri("http://myserver.com/home.aspx")