-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcalender.py
49 lines (46 loc) · 1.43 KB
/
calender.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/python:
# -*- coding: utf-8 -*-
from sys import argv
import tweepy
import facebook
script, first = argv
def get_api_tweet(cfg):
auth = tweepy.OAuthHandler(cfg['consumer_key'], cfg['consumer_secret'])
auth.set_access_token(cfg['access_token'], cfg['access_token_secret'])
return tweepy.API(auth)
def main_tweet():
cfg = {
"consumer_key" : " ",
"consumer_secret" : " ",
"access_token" : " - ",
"access_token_secret" : " "
}
api = get_api_tweet(cfg)
tweet = "இன்ரைய நாள் காட்டி #tamilcalender (©belongs to watermarked party),"
#tweet = 'test'
image_path = "%s"%first
status = api.update_with_media(image_path,tweet)
if __name__ == "__main__":
main_tweet()
def main():
cfg = {
"page_id" : " ",
"access_token" : " &"
}
api = get_api(cfg)
def get_api(cfg):
graph = facebook.GraphAPI(cfg['access_token'])
resp = graph.get_object('me/accounts')
page_access_token = None
for page in resp['data']:
if page['id'] == cfg['page_id']:
page_access_token = page['access_token']
graph = facebook.GraphAPI(page_access_token)
#caption = ''
caption = "இன்ரைய நாள் காட்டி #tamilcalender (©belongs to watermarked party)"
albumid = ''
with open(first,"rb") as image:
posted_image_id = graph.put_photo(image, caption, albumid)
return graph
if __name__ == "__main__":
main()