Giter Club home page Giter Club logo

Comments (8)

Big-Shark avatar Big-Shark commented on July 25, 2024 2

@trogwarz You can try this.

services:
  GuzzleHttp\Client:
    arguments:
      - { timeout: 120, proxy : '%env(TELEGRAM_PROXY)%'}

  Http\Adapter\Guzzle6\Client:
    arguments:
      - '@GuzzleHttp\Client'

  TgBotApi\BotApiBase\ApiClient:
        arguments:
            $requestFactory: '@Psr\Http\Message\RequestFactoryInterface'
            $streamFactory: '@Psr\Http\Message\StreamFactoryInterface'
            $client: '@Http\Adapter\Guzzle6\Client:'

from bot-api-base.

trogwarz avatar trogwarz commented on July 25, 2024 2

Sorry for late answer. This works, thank you!

from bot-api-base.

greenplugin avatar greenplugin commented on July 25, 2024 1

Hi! We will add possibility to answer webhooks in 2-3 days (#30).

from bot-api-base.

greenplugin avatar greenplugin commented on July 25, 2024 1

@Big-Shark I think you can show examples for few clients. It's may come in handy for all.

from bot-api-base.

trogwarz avatar trogwarz commented on July 25, 2024

I mean, not only answer to them but sending requests too, in general.
It would be awesome if there will be possibility to set proxy in yaml config. 👍

from bot-api-base.

greenplugin avatar greenplugin commented on July 25, 2024

Аbout proxy, you can set it up in your http client config:
symfony http client can follows system proxies
for other clients you can find it in client docs.
@Big-Shark, please provide examples how to set guzzle up in symfony config, or, maybe, set other clients too.

from bot-api-base.

Big-Shark avatar Big-Shark commented on July 25, 2024

@trogwarz Can you send me your YAML config? Because I need to know, what do you use, Symfony HTTP client, buzz, guzzle, or something else.

from bot-api-base.

trogwarz avatar trogwarz commented on July 25, 2024

@trogwarz Can you send me your YAML config? Because I need to know, what do you use, Symfony HTTP client, buzz, guzzle, or something else.

Sure. Here is some info about packages and versions i'm using. From server that is outside of Russia – works perfectly. It would be great to write help information about proxy config in that situation.

  • php:7.4
  • symfony/*:5.0.7
  • tg-bot-api/bot-api-base:1.3.3
  • nyholm/psr7:1.2.1
  • http-interop/http-factory-guzzle:1.0.0
  • php-http/guzzle6-adapter:2.0.1

Config files:

./config/packages/nyholm_psr7.yaml:

services:
    # Register nyholm/psr7 services for autowiring with PSR-17 (HTTP factories)
    Psr\Http\Message\RequestFactoryInterface: '@nyholm.psr7.psr17_factory'
    Psr\Http\Message\ResponseFactoryInterface: '@nyholm.psr7.psr17_factory'
    Psr\Http\Message\ServerRequestFactoryInterface: '@nyholm.psr7.psr17_factory'
    Psr\Http\Message\StreamFactoryInterface: '@nyholm.psr7.psr17_factory'
    Psr\Http\Message\UploadedFileFactoryInterface: '@nyholm.psr7.psr17_factory'
    Psr\Http\Message\UriFactoryInterface: '@nyholm.psr7.psr17_factory'

    # Register nyholm/psr7 services for autowiring with HTTPlug factories
    Http\Message\MessageFactory: '@nyholm.psr7.httplug_factory'
    Http\Message\RequestFactory: '@nyholm.psr7.httplug_factory'
    Http\Message\ResponseFactory: '@nyholm.psr7.httplug_factory'
    Http\Message\StreamFactory: '@nyholm.psr7.httplug_factory'
    Http\Message\UriFactory: '@nyholm.psr7.httplug_factory'

    nyholm.psr7.psr17_factory:
        class: Nyholm\Psr7\Factory\Psr17Factory

    nyholm.psr7.httplug_factory:
        class: Nyholm\Psr7\Factory\HttplugFactory

./config/packages/tg_bot_api.yaml:

services:

    TgBotApi\BotApiBase\ApiClient:
        arguments:
            $requestFactory: '@Psr\Http\Message\RequestFactoryInterface'
            $streamFactory: '@Psr\Http\Message\StreamFactoryInterface'
            $client: '@Psr\Http\Client\ClientInterface'

    TgBotApi\BotApiBase\BotApiNormalizer: null

    TgBotApi\BotApiBase\ApiClientInterface: '@TgBotApi\BotApiBase\ApiClient'
    TgBotApi\BotApiBase\NormalizerInterface: '@TgBotApi\BotApiBase\BotApiNormalizer'

    TgBotApi\BotApiBase\BotApi:
        arguments:
            $botKey: '%env(resolve:TG_BOT_API_KEY)%'
            $apiClient: '@TgBotApi\BotApiBase\ApiClientInterface'
            $normalizer:  '@TgBotApi\BotApiBase\NormalizerInterface'

    TgBotApi\BotApiBase\BotApiComplete:
        parent: TgBotApi\BotApiBase\BotApi

    TgBotApi\BotApiBase\BotApiInterface: '@TgBotApi\BotApiBase\BotApi'

from bot-api-base.

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.