标签: http-status-code-403

对于大小超过 ~1MB 的文件,来自 Github.js getSha 的 403 错误

当我尝试使用Github.js从大于 ~1MB 的文件中 getSha(以及随后的 getBlob)时,出现 403 错误。文件大小有限制吗?代码如下:

var gh = new GitHub({
    username: username,
    password: password
});

// get the repo from github
var repo = gh.getRepo('some-username','name-of-repo');

// get promise
repo.getSha('some-branch', 'some-file.json').then(function(result){

  // pass the sha onto getBlob
  return repo.getBlob(result.data.sha);

}).then(function(result){

  do_something_with_blob(result.data);

});
Run Code Online (Sandbox Code Playgroud)

GitHub API 表示它支持最大 100MB 的 blob,但我在Github.js 文档中找不到任何有关文件大小限制的信息。此外,这些文件来自私人 Github 存储库。

javascript github github-api http-status-code-403 github.js

5
推荐指数
1
解决办法
762
查看次数

Google 驱动器映像出现 403 禁止错误

我正在使用谷歌驱动器在网站上显示图像。我使用以下网址来显示图像:

https://drive.google.com/uc?export=view&id={fileId}
Run Code Online (Sandbox Code Playgroud)

它在大多数情况下工作正常,但有些用户看不到图像并收到以下错误消息:

Failed to load resource: the server responded with a status of 403 ()
Run Code Online (Sandbox Code Playgroud)

谷歌驱动器上的图像文件和文件夹与每个人共享,并有一个链接可供查看。该问题似乎与浏览器无关。

有人知道如何解决这个问题吗?是否有一些我忘记做的事情(我是否需要链接中的某种 API 密钥)?

image http-status-code-403 google-drive-api

5
推荐指数
1
解决办法
7142
查看次数

向 opensea API 发出 403 错误的 GET 请求

我正在尝试使用资产端点从特定集合中检索资产信息。

例子:

https://api.opensea.io/api/v1/asset/0x1a92f7381b9f03921564a437210bb9396471050c/2000/?format=json

现在,如果您在浏览器上打开它,它可以完美运行,但在您的应用程序或邮递员上,它只会给出 CloudFlare 的 403 错误。这不是 401 错误,我们不需要为此提供 API 密钥。

那么这是怎么回事以及如何解决这个问题?有任何想法吗?

api rest get http-status-code-403 opensea

5
推荐指数
0
解决办法
2202
查看次数

尝试抓取页面时收到 403 错误

我下面的代码使用 C# 和 HTMLAgilityPack 抓取网页,然后使用 WebClient 从另一个网页下载字符串。这在 localhost 上效果很好,但是当我在 Azure 上将代码发布为 API 服务或在 Web 托管服务(即主机 gator)上执行时,我总是收到 403 禁止错误。我已经尝试了很多方法来让它发挥作用,但我一生都无法弄清楚这一点。任何帮助将不胜感激。

HtmlWeb web = new HtmlWeb();
HtmlDocument doc = web.Load("https://antenati.cultura.gov.it/ark:/12657/an_ud18290200");
//string returnedResult = doc.DocumentNode.OuterHtml; //this shows a 403 forbidden error response when not running from localhost.
string ress = doc.DocumentNode.SelectSingleNode("//*[text()[contains(., 'manifestId:')]]").InnerText;

if (!string.IsNullOrEmpty(ress))
{
    string[] strPieces = ress.Split(new string[] { "manifestId:" }, StringSplitOptions.None);
    if (strPieces.Length >= 2)
    {
        WebClient wb = new WebClient();
        string manifestUrl = strPieces[1].Split(',')[0].Replace("'", "").Trim();
        wb.Headers.Add("origin", "https://antenati.cultura.gov.it");
        wb.Headers.Add("referer", "https://antenati.cultura.gov.it/");
        wb.Headers.Add("user-agent", …
Run Code Online (Sandbox Code Playgroud)

c# localhost web-scraping http-status-code-403 html-agility-pack

5
推荐指数
1
解决办法
840
查看次数

使用.htaccess重定向403错误

我想使用.htaccess重定向任何403,但似乎无法正常工作。

Options +FollowSymlinks

RewriteEngine on
ErrorDocument 403 notfound.html
RewriteRule notfound.html
Run Code Online (Sandbox Code Playgroud)

所有帮助表示赞赏。

谢谢让

linux .htaccess http-status-code-403

4
推荐指数
2
解决办法
3万
查看次数

重定向+ 403错误

我正在寻找一种类似的方法:

return HttpResponseForbiddenRedirect(reverse("view_name"))
Run Code Online (Sandbox Code Playgroud)

一个HttpResponse,它重定向到一个视图(带有它的名字),但仍然抛出403错误

我试着这样做:

class HttpResponseForbiddenRedirect(HttpResponse):
    def __init__(self, redirect_to):
        super(HttpResponseForbiddenRedirect, self).__init__()
        self['Location'] = iri_to_uri(redirect_to)
        self.status_code = 403
Run Code Online (Sandbox Code Playgroud)

但它没有用.出于某种原因,我不明白,我没有得到任何内容

django redirect http-error http-status-code-403

4
推荐指数
1
解决办法
3811
查看次数

403从IIS上的服务堆栈提供swf文件时出错

我正在尝试从使用Service Stack的Web应用程序提供swf文件.在请求swf文件时,我得到403响应(见下文).我没有遇到这个问题从这个应用程序提供任何其他静态文件(html,css,js,xap,jpg,png等...)

在Visual Studio中进行调试以及将站点部署到IIS时,会发生相同的行为.

有没有其他人遇到过类似的问题?

以下是服务器的响应:

Forbidden

Request.HttpMethod: GET
Request.PathInfo: 
Request.QueryString: 
Request.RawUrl: /swf/plupload/plupload.flash.swf
App.IsIntegratedPipeline: False
App.WebHostPhysicalPath: C:\Users\me\Documents\GitHub\Project\src\Project.Host.Web
App.WebHostRootFileNames: [project.host.web.csproj,project.host.web.csproj.user,apphost.cs,customusersession.cs,default.html,global.asax,global.asax.cs,packages.config,plupload.flash.swf,web.config,web.debug.config,web.release.config,app_data,bin,css,img,js,logs,obj,properties,swf,xap]
App.DefaultRootFileName: default.html
Run Code Online (Sandbox Code Playgroud)

iis flash http-status-code-403 servicestack

4
推荐指数
1
解决办法
863
查看次数

URL的commons io 403,但httpclient可以

公地io代码:

String resultURL = String.format(GOOGLE_RECOGNIZER_URL, URLEncoder.encode("hello", "UTF-8"), "en-US");
URI uri = new URI(resultURL);
byte[] resultIO = IOUtils.toByteArray(uri);
Run Code Online (Sandbox Code Playgroud)

我有这个例外:

Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: http://translate.google.cn/translate_tts?ie=UTF-8&q=hello&tl=en-US&total=1&idx=0&textlen=3
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
    at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:654)
    at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:635)
    at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:617)
    at com.renren.intl.soundsns.simsimi.speech.ttsclient.impl.GoogleTTSClient.main(GoogleTTSClient.java:70)
Run Code Online (Sandbox Code Playgroud)

但是当我使用httpclient时,结果还可以。

String resultURL = String.format(GOOGLE_RECOGNIZER_URL, URLEncoder.encode(text, "UTF-8"), "en-US");

HttpClient client = new HttpClient();

GetMethod g = new GetMethod(resultURL);

client.executeMethod(g);

byte[] resultByte = g.getResponseBody();
Run Code Online (Sandbox Code Playgroud)

这是怎么发生的?

提前致谢 :)

Maven的依赖:

<dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
</dependency>
<dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

java http httpclient http-status-code-403 apache-commons-io

4
推荐指数
1
解决办法
2638
查看次数

Python Requests库返回错误的状态代码

下面的Python代码返回'403':

import requests
url = 'http://bedstardirect.co.uk/star-collection-braemar-double-bedstead.html'
r = requests.get(url)
print r.status_code
Run Code Online (Sandbox Code Playgroud)

但是这个页面是有效的,脚本应该返回'200',下面的perl脚本也是如此:

use WWW::Mechanize;
my $mech = WWW::Mechanize->new();
my $url = 'http://bedstardirect.co.uk/star-collection-braemar-double-bedstead.html';
$mech->get($url);
print $mech->status,"\n";
Run Code Online (Sandbox Code Playgroud)

我还在Firefox中检查了Firebug,所有请求都有一个'200'状态代码.

我使用Python Requests v1.2.0.

http-status-code-403 python-2.7 python-requests

4
推荐指数
1
解决办法
1671
查看次数

在php中触发403,以便显示ErrorDocument

最近我为我的服务器设置了定制的错误文档.

我开始使用404页面,这就像一个魅力:未找到的文件会自动显示指定的404.php页面.但是,403我遇到了一些麻烦.我以同样的方式设置它,但我只得到一个空白页面.它不显示.htaccess文档中设置的403.php页面.有任何想法吗?

这是我的代码:

的.htaccess:

Options -Indexes
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
Run Code Online (Sandbox Code Playgroud)

PHP:

<?php 
header("HTTP/1.1 403 Unauthorized");
exit;
?>
Run Code Online (Sandbox Code Playgroud)

php .htaccess http-status-code-403

4
推荐指数
1
解决办法
7278
查看次数