Уведомления

Группа в Telegram: @pythonsu

#1 Дек. 17, 2012 09:17:35

kise97
Зарегистрирован: 2012-05-31
Сообщения: 83
Репутация: +  4  -
Профиль  

TWEEPY: update_profile_background_image

Здравствуйте уважаемые формучане.

У меня проблема с использованием одной из функций tweepy, а именно

http://code.google.com/p/tweepy/wiki/APIReference#update_profile_background_image
update_profile_background_image
Update authenticating user's background image. Valid formats: GIF, JPG, or PNG
Parameters: filename (Path to image file. Required), tile
Returns: User object

Как видите, можно передать 2 параметра, filename - имя файла, обязательный и tile - “замостить” бекграунд, необязательный.

https://dev.twitter.com/docs/api/1/post/account/update_profile_background_image
filename - The background image for the profile, base64-encoded. Must be a valid GIF, JPG, or PNG image of less than 800 kilobytes in size. Images with width larger than 2048 pixels will be forcibly scaled down. The image must be provided as raw multipart data, not a URL.
tile - Whether or not to tile the background image. If set to true, t or 1 the background image will be displayed tiled. The image will not be tiled otherwise.

Так вот, я использую такой код:

api.update_profile_background_image(filename=TEXTURES+random.choice(os.listdir(TEXTURES)),tile=1)

И у меня получается что то вроде этого



А должно получится такое




Вот так выглядит функция update_profile_background_image в tweepy:
    def update_profile_background_image(self, filename, *args, **kargs):
        headers, post_data = API._pack_image(filename, 800)
        bind_api(
            path = '/account/update_profile_background_image.json',
            method = 'POST',
            payload_type = 'user',
            allowed_param = ['tile'],
            require_auth = True
        )(self, post_data=post_data, headers=headers)



Что я делаю не так?

Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version