Giter Club home page Giter Club logo

Comments (4)

yyuueexxiinngg avatar yyuueexxiinngg commented on June 4, 2024

py-ciohttp测试了一下

使用file url发送失败且报相同错误, 但是base64和https均成功, 可以请问下您的测试环境吗?

image

另外 Server returned HTTP response code: 403 指禁止访问, 是否网络环境出了问题?

from onebot-kotlin.

Cuiyn avatar Cuiyn commented on June 4, 2024

感谢您的测试与回复!

这边使用的是nonebot,据其文档,其底层同样使用py-ciohttp,感觉与您的环境是类似的;代码附在下面:

@on_command('发送图片', only_to_me=False)
async def _(session: CommandSession):
    msg = '[CQ:image,file=https://i.loli.net/2020/05/28/uKvIAWadFC3csPO.jpg]'
    await session.send(msg)

使用wget命令能够正常下载到这张图片;如果问题不能重现,我认为应该是自身环境的问题,这边会继续排查一下。

最后再次感谢您带来了如此优秀的项目!

from onebot-kotlin.

yyuueexxiinngg avatar yyuueexxiinngg commented on June 4, 2024

cqhttp-mirai的配置文件setting.yaml的第一行可加入配置debug属性来log接受到的请求, 或许可以提供一些思路

debug: true
1234567890:
   ......

经测试Nonebot亦可正常发送, 测试mirai版本为1.0.1, mirai-console版本为0.5.2, cqhttp-mirai版本为0.1.2

image

from onebot-kotlin.

Cuiyn avatar Cuiyn commented on June 4, 2024

与您环境相同,目前还未能确定产生403错误的原因。

注意到使用Pythonurllib不能直接下载图片(同样产生403错误),但是设置请求的Header为任意值后就可以了。由此猜想可能是触发了相关服务的反爬虫机制,IP受到限制。小图片下载并使用Base64编码后可以正常发送。

谢谢您的测试!

from onebot-kotlin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.