|
|
@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
import facebook
|
|
|
|
|
|
|
|
import requests
|
|
|
|
import twitter
|
|
|
|
import twitter
|
|
|
|
|
|
|
|
|
|
|
|
from bureau import Bureau, add_command, add_api
|
|
|
|
from bureau import Bureau, add_command, add_api
|
|
|
@ -40,6 +42,33 @@ class PublicRelations(Bureau):
|
|
|
|
id_img1 = t_up.media.upload(media=imagedata)["media_id_string"]
|
|
|
|
id_img1 = t_up.media.upload(media=imagedata)["media_id_string"]
|
|
|
|
self.t.t.statuses.update(status="#screenless", media_ids=id_img1)
|
|
|
|
self.t.t.statuses.update(status="#screenless", media_ids=id_img1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@add_command("fbpost", "Post to Facebook")
|
|
|
|
|
|
|
|
def post_fb(self):
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
Takes a photograph using the document camera and posts it to Facebook.
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
photo = self.send("PX", "photo")["photo"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
access_token = 'EAADixisn70ABADh2rEMZAYA8nGzd6ah8RFZA3URba263aCQ63ajLeTiZC5sgZCyIVSmRZBWReVsO9IuaLibX5RjW9Ja2tTZAbxgrDr1dPJzyGwcGTSV9bW1W4NigN0d9dFIH35W2fZBOkhvuLqOCDCBacIPjXPMxF7DRGyrz5lVHxTc04OlBeRX'
|
|
|
|
|
|
|
|
page_id = "screenless"
|
|
|
|
|
|
|
|
graph = facebook.GraphAPI(access_token)
|
|
|
|
|
|
|
|
#graph.put_object(parent_object=page_id, connection_name='feed',
|
|
|
|
|
|
|
|
# message='testing screenless post')
|
|
|
|
|
|
|
|
print("uploading photo " + photo)
|
|
|
|
|
|
|
|
graph.put_photo(image=open(photo, 'rb'), album_path=page_id + "/photos",
|
|
|
|
|
|
|
|
message='test photo')
|
|
|
|
|
|
|
|
#files = {"file": ("cam.jpg", open(photo, 'rb'))}
|
|
|
|
|
|
|
|
#args = {}
|
|
|
|
|
|
|
|
#args["access_token"] = access_token
|
|
|
|
|
|
|
|
#args["caption"] = "test cam"
|
|
|
|
|
|
|
|
#resp = requests.post(facebook.FACEBOOK_GRAPH_URL + graph.version + "/"\
|
|
|
|
|
|
|
|
# + "me" + "/photos",
|
|
|
|
|
|
|
|
# files=files,
|
|
|
|
|
|
|
|
# params=args,
|
|
|
|
|
|
|
|
# timeout=graph.timeout,
|
|
|
|
|
|
|
|
# proxies=graph.proxies)
|
|
|
|
|
|
|
|
#print(resp.json())
|
|
|
|
|
|
|
|
|
|
|
|
@add_command("twtimeline", "Print Recent Tweets")
|
|
|
|
@add_command("twtimeline", "Print Recent Tweets")
|
|
|
|
def tw_timeline(self, data=None):
|
|
|
|
def tw_timeline(self, data=None):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|