我很难尝试使用webclient对accounts.google.com进行身份验证
我正在使用C#WebClient对象来实现以下功能.
我将表单字段提交到https://accounts.google.com/ServiceLoginAuth?service=oz
这是POST字段:
service=oz
dsh=-8355435623354577691
GALX=33xq1Ma_CKI
timeStmp=
secTok=
Email=test@test.xom
Passwd=password
signIn=Sign in
PersistentCookie=yes
rmShown=1
Run Code Online (Sandbox Code Playgroud)
现在,在我提交数据之前加载登录页面时,它有以下标题:
Content-Type text/html; charset=UTF-8
Strict-Transport-Security max-age=2592000; includeSubDomains
Set-Cookie GAPS=1:QClFh_dKle5DhcdGwmU3m6FiPqPoqw:SqdLB2u4P2oGjt_x;Path=/;Expires=Sat, 21-Dec-2013 07:31:40 GMT;Secure;HttpOnly
Cache-Control no-cache, no-store
Pragma no-cache
Expires Mon, 01-Jan-1990 00:00:00 GMT
X-Frame-Options Deny
X-Auto-Login realm=com.google&args=service%3Doz%26continue%3Dhttps%253A%252F%252Faccounts.google.com%252FManageAccount
Content-Encoding gzip
Transfer-Encoding chunked
Date Thu, 22 Dec 2011 07:31:40 GMT
X-Content-Type-Options nosniff
X-XSS-Protection 1; mode=block
Server GSE
Run Code Online (Sandbox Code Playgroud)
好了,现在我如何使用WebClient Class来包含这些标题?
我尝试过,webClient_.Headers.Add();但效果有限,总是返回登录页面.
以下是我使用的课程.非常感谢任何帮助.
获取登录页面
public void LoginPageRequest(Account acc)
{
var rparams = new RequestParams();
rparams.URL = @"https://accounts.google.com/ServiceLoginAuth?service=oz"; …Run Code Online (Sandbox Code Playgroud) 如果您的代理服务器需要身份验证,则在下面的代码中设置代理服务器参数,然后FireFox将带来身份验证对话框,基本上您无法自动填写它.那么无论如何设置USERNAME和PASSWORD?
FirefoxProfile profile = new FirefoxProfile();
String PROXY = "192.168.1.100:8080";
OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy();
proxy.HttpProxy=PROXY;
proxy.FtpProxy=PROXY;
proxy.SslProxy=PROXY;
profile.SetProxyPreferences(proxy);
FirefoxDriver driver = new FirefoxDriver(profile);
Run Code Online (Sandbox Code Playgroud)
如果您尝试将代理字符串格式化为类似的东西http://username:pass@192.168.1.1:8080
您会收到字符串无效的错误.所以我想知道必须有一种实现这一目标的方法.
任何帮助,将不胜感激.
问题是child指令绑定到parent但是语法{{name}}被忽略ng-repeat.实现这一目标的正确方法是什么?
HTML(主/子指令)
<compact-select
no-item-selected-text="Add a Customer"
no-item-selected-icon="fa-user"
search-placeholder="Type a customer name"
cs-model="customer"
cs-items="contacts"
>
<display-item-template>
<span>{{name}}</span>
or
<span>{{item.name}}</span>
</display-item-template>
</compact-select>
Run Code Online (Sandbox Code Playgroud)
指示
angular.module('core').directive('compactSelect', [function($timeout) {
return {
templateUrl : 'modules/core/views/components/compact-select-tpl.html',
bindToController: true,
transclude: true,
scope: {
noItemSelectedText: '@',
noItemSelectedIcon: '@',
csModel: '=',
csItems: '=csItems'
},
controllerAs : 'ctrl',
controller : function($scope) {
}
};
}]).directive('displayItemTemplate', function($timeout) {
return {
require: '^compactSelect',
restrict: 'E'
}
});
Run Code Online (Sandbox Code Playgroud)
指令模板(modules/core/views/components/compact-select-tpl.html)
<div class="compact-select-repeater-box" style="" >
<div ng-transclude ng-repeat="item in ctrl.csItems | filter:searchParam" …Run Code Online (Sandbox Code Playgroud) javascript angularjs angularjs-directive ng-repeat angularjs-ng-transclude
我已经知道Selenium是UI测试之父.
现在我的问题是为什么然后Angular团队开发了Protractor.对于基于AngularJS的Web应用程序,Selenium不能完成同样的工作(Protractor所做的)吗?
此外,人们也在谈论Nightwatch.js.那么为什么有这么多的E2E测试库/框架,如Protracor或Nightwatch.
我在下面有这个代码,我循环遍历字符串,并通过char比较所有char,这是非常慢的过程,我想知道如何改进这段代码.
//delete anti-xss junk ")]}'\n" (5 chars);
if (trim)
{
googlejson = googlejson.Substring(5);
}
//pass through result and turn empty elements into nulls
//echo strlen( $googlejson ) . '<br>';
bool instring = false;
bool inescape = false;
string lastchar = "";
string output = "";
for ( int x=0; x< googlejson.Length; x++ ) {
string ch = googlejson.Substring(x, 1);
//toss unnecessary whitespace
if ( !instring && ( Regex.IsMatch(ch, @"/\s/"))) {
continue;
}
//handle strings
if ( instring ) {
if …Run Code Online (Sandbox Code Playgroud) model.fit 产生异常:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot update variable with shape [] using a Tensor with shape [32], shapes must be equal.
[[{{node metrics/accuracy/AssignAddVariableOp}}]]
[[loss/dense_loss/categorical_crossentropy/weighted_loss/broadcast_weights/assert_broadcastable/AssertGuard/pivot_f/_50/_63]] [Op:__inference_keras_scratch_graph_1408]
Run Code Online (Sandbox Code Playgroud)
型号定义:
model = tf.keras.Sequential()
model.add(tf.keras.layers.InputLayer(
input_shape=(360, 7)
))
model.add(tf.keras.layers.Conv1D(32, 1, activation='relu', input_shape=(360, 7)))
model.add(tf.keras.layers.Conv1D(32, 1, activation='relu'))
model.add(tf.keras.layers.MaxPooling1D(3))
model.add(tf.keras.layers.Conv1D(512, 1, activation='relu'))
model.add(tf.keras.layers.Conv1D(1048, 1, activation='relu'))
model.add(tf.keras.layers.GlobalAveragePooling1D())
model.add(tf.keras.layers.Dropout(0.5))
model.add(tf.keras.layers.Dense(32, activation='softmax'))
Run Code Online (Sandbox Code Playgroud)
输入特征形状
(105, 360, 7)
Run Code Online (Sandbox Code Playgroud)
输入标签形状
(105, 32, 1)
Run Code Online (Sandbox Code Playgroud)
编译语句
model.compile(optimizer='adam',
loss=tf.keras.losses.CategoricalCrossentropy(),
metrics=['accuracy'])
Run Code Online (Sandbox Code Playgroud)
Model.fit 语句
model.fit(features,
labels,
epochs=50000,
validation_split=0.2,
verbose=1)
Run Code Online (Sandbox Code Playgroud)
任何帮助将非常感激
c# ×3
angularjs ×2
selenium ×2
cookies ×1
javascript ×1
ng-repeat ×1
post ×1
protractor ×1
python-3.x ×1
tensor ×1
tensorflow ×1
webclient ×1
webdriver ×1