2

In python facebook SDK , we are missing to upload photos , rather i want to upload photos without using the existing SDKs ..

so how can implments thsese steps in python ??

You can publish a photo to a specific, existing photo album with a POST to http://graph.facebook.com/ALBUM_ID/photos.

curl -F 'access_token=...' \
     -F 'source=@file.png' \
     -F 'message=Caption for the photo' \
     https://graph.facebook.com/me/photos
Adham
  • 63,550
  • 98
  • 229
  • 344

2 Answers2

2

You can use urllib2 or the poster module to make post requests, take a look at these questions:

python urllib2 file send problem

Using MultipartPostHandler to POST form-data with Python

Community
  • 1
  • 1
Vasco Fernandes
  • 688
  • 1
  • 4
  • 11
  • thanks, but i'm not expert at these .. and i need it as soon as possible ..doing it for me will be really appreciated – Adham Feb 24 '11 at 20:02
  • 2
    "and i need it as soon as possible .." - stop misusing our resources for getting your work done. –  Feb 24 '11 at 20:38
2

This isn't a place to get work done cheaply but to learn about programming, so doubtful that someone will do your work for you if he doesn't already have the code lying around.

Anyhow a few pointers: Get yourself Tamper Data or a similar plugin for whatever browser you're using and document all the data that is sent when you're doing the task manually. Afterwards you just have to use the Python urllib lib to imitate that and parse the html documents for the non static parts you need.

No idea about facebook (no account) but you'll presumably have to login and keep cookies, so a small example of something pretty similar I had lying around. First use the login site to login and then maneuver to the site I'm interested in and get the data..

def get_site_content():
    def get_response(response):
        content = response.info()['Content-Type']
        charset = content[content.rfind('=') + 1:] # ugly hack, check orderly
        return response.read().decode(charset)  

    cj = http.cookiejar.CookieJar()
    opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
    data = urllib.parse.urlencode({ "log" : "1", "j_username" : USERNAME, "j_password" : PASSWORD })
    opener.open("url", data)  
    data = urllib.parse.urlencode({ "months" : "0" })
    resp = opener.open("url2", data)
    return get_response(resp)
Voo
  • 29,040
  • 11
  • 82
  • 156