Telegram Group & Telegram Channel
Упаковка параметров с помощью urlencode

Довольно часто приходится работать с разнообразными API и совершать get-запросы с передачей множества параметров. Чаще всего составление запроса в коде выглядит примерно так:

url = 'https://example.com?item={}&size={}&color={}&amount={}'.format('t-shirt', 'M', 'white', 5)

Смотрится не слишком презентабельно, однако есть слегка более длинный, но значительно улучающий читаемость кода вариант – функция urlencode из модуля urllib.

Подписывайтесь на канал 👉@pythonofff



tg-me.com/pythonofff/2907
Create:
Last Update:

Упаковка параметров с помощью urlencode

Довольно часто приходится работать с разнообразными API и совершать get-запросы с передачей множества параметров. Чаще всего составление запроса в коде выглядит примерно так:

url = 'https://example.com?item={}&size={}&color={}&amount={}'.format('t-shirt', 'M', 'white', 5)

Смотрится не слишком презентабельно, однако есть слегка более длинный, но значительно улучающий читаемость кода вариант – функция urlencode из модуля urllib.

Подписывайтесь на канал 👉@pythonofff

BY Python академия




Share with your friend now:
tg-me.com/pythonofff/2907

View MORE
Open in Telegram


Python академия Telegram | DID YOU KNOW?

Date: |

What is Telegram?

Telegram is a cloud-based instant messaging service that has been making rounds as a popular option for those who wish to keep their messages secure. Telegram boasts a collection of different features, but it’s best known for its ability to secure messages and media by encrypting them during transit; this prevents third-parties from snooping on messages easily. Let’s take a look at what Telegram can do and why you might want to use it.

Export WhatsApp stickers to Telegram on iPhone

You can’t. What you can do, though, is use WhatsApp’s and Telegram’s web platforms to transfer stickers. It’s easy, but might take a while.Open WhatsApp in your browser, find a sticker you like in a chat, and right-click on it to save it as an image. The file won’t be a picture, though—it’s a webpage and will have a .webp extension. Don’t be scared, this is the way. Repeat this step to save as many stickers as you want.Then, open Telegram in your browser and go into your Saved messages chat. Just as you’d share a file with a friend, click the Share file button on the bottom left of the chat window (it looks like a dog-eared paper), and select the .webp files you downloaded. Click Open and you’ll see your stickers in your Saved messages chat. This is now your sticker depository. To use them, forward them as you would a message from one chat to the other: by clicking or long-pressing on the sticker, and then choosing Forward.

Python академия from de


Telegram Python академия
FROM USA