Uploading binary image to instagram post request
I am trying to change the user profile picture on instagram programmatically via HTTP requests. I'm unsure as to why the profile picture has not updated. I have used many examples on stackoverflow (Upload Image using POST form data in Python-requests) along with the official docs for requests (http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file). Here is the current method I am working on:
def update_profile_pic(self):
get_change_pic = self.session.get('https://www.instagram.com/' + self.username, headers=self.headers)
self.session.headers.update({
'user-agent' : self.user_agent,
'x-csrftoken' : get_change_pic.cookies['csrftoken'],
'content-type' : 'multipart/form-data; boundary=----WebKitFormBoundaryUIboB46mvoIt1m9R',
'referer' : 'https://www.instagram.com/' + self.username + '/',
'origin' : 'https://www.instagram.com'
})
files = {'profile_pic': ('profilepic.jpg',
open('profilepic.jpg', 'rb').read(),
'image/jpeg',
{
'Content-Disposition' : 'form-data;',
}
)}
change_pic = self.session.post('https://www.instagram.com/accounts/web_change_profile_picture/', files=files)
print(change_pic.text)
Here is the response that I get from my program:
{"changed_profile": true, "id": 9129479436, "has_profile_pic": false, "profile_pic_url": "https://instagram.fmkc1-1.fna.fbcdn.net/vp/c012aa3473e225c235b274cb8a51c620/5C716EDF/t51.2885-19/38905493_2193354514245732_6791661364604567552_n.jpg", "profile_pic_url_hd": "https://instagram.fmkc1-1.fna.fbcdn.net/vp/c012aa3473e225c235b274cb8a51c620/5C716EDF/t51.2885-19/38905493_2193354514245732_6791661364604567552_n.jpg", "profile_pic_to_post_upsell_eligible": true, "status": "ok"}
Here is the response I get when manually uploading a pic, via instagram.com:
{"changed_profile": true, "id": 9129479436, "has_profile_pic": true, "profile_pic_url": "https://instagram.fbed1-1.fna.fbcdn.net/vp/827163eecb3fb3ed2cd7969528fd92da/5C6A10A3/t51.2885-19/44785389_226951028028925_6866362025681879040_n.jpg", "profile_pic_url_hd": "https://instagram.fbed1-1.fna.fbcdn.net/vp/827163eecb3fb3ed2cd7969528fd92da/5C6A10A3/t51.2885-19/44785389_226951028028925_6866362025681879040_n.jpg", "status": "ok"}
Response headers:
access-control-allow-credentials: true
access-control-allow-origin: https://www.instagram.com
cache-control: private, no-cache, no-store, must-revalidate
content-encoding: gzip
content-language: en
content-length: 217
content-security-policy: report-uri https://www.instagram.com/security/csp_report/; default-src 'self' https://www.instagram.com; img-src https: data: blob:; font-src https: data:; media-src 'self' blob: https://www.instagram.com https://*.cdninstagram.com https://*.fbcdn.net; manifest-src 'self' https://www.instagram.com; script-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://*.cdninstagram.com wss://www.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' https://*.www.instagram.com https://www.instagram.com 'unsafe-inline'; connect-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://graph.instagram.com https://*.graph.instagram.com https://*.cdninstagram.com https://api.instagram.com wss://www.instagram.com wss://edge-chat.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net chrome-extension://boadgeojelhgndaghljhdicfkmllpafd; worker-src 'self' https://www.instagram.com; frame-src 'self' https://instagram.com https://www.instagram.com https://staticxx.facebook.com https://www.facebook.com https://web.facebook.com https://connect.facebook.net https://m.facebook.com; object-src 'none'; upgrade-insecure-requests
content-type: application/json; charset=utf-8
date: Sun, 18 Nov 2018 03:22:59 GMT
expires: Sat, 01 Jan 2000 00:00:00 GMT
pragma: no-cache
set-cookie: rur=ATN; Domain=.instagram.com; HttpOnly; Path=/; Secure
set-cookie: ds_user_id=9129479436; Domain=.instagram.com; expires=Sat, 16-Feb-2019 03:22:59 GMT; Max-Age=7776000; Path=/; Secure
set-cookie: urlgen="{}:1gODfn:oseVSKSqi_G7dsrw-sGyYnB4UB8"; Domain=.instagram.com; HttpOnly; Path=/; Secure
set-cookie: csrftoken=CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu; Domain=.instagram.com; expires=Sun, 17-Nov-2019 03:22:59 GMT; Max-Age=31449600; Path=/; Secure
status: 200
strict-transport-security: max-age=60
vary: Accept-Language, Cookie, Accept-Encoding
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 0
Request headers:
:authority: www.instagram.com
:method: POST
:path: /accounts/web_change_profile_picture/
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
content-length: 8638
content-type: multipart/form-data; boundary=----WebKitFormBoundaryf3YOtJCAfKhjZCVf
cookie: mid=W_DaPQAEAAGEpui-cKxkbCScmijn; mcd=3; csrftoken=CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu; ds_user_id=9129479436; sessionid=IGSC24a182fcba699695123d686dee80a45615c1368c599d73392433f7a465714a70%3A8Bc4cb2j59ZJJFGKCLXEa4v3uUJBz63g%3A%7B%22_auth_user_id%22%3A9129479436%2C%22_auth_user_backend%22%3A%22accounts.backends.CaseInsensitiveModelBackend%22%2C%22_auth_user_hash%22%3A%22%22%2C%22_platform%22%3A4%2C%22_token_ver%22%3A2%2C%22_token%22%3A%229129479436%3AUgJfZH2OoUcdCLyhaMthiwJgIXATamnB%3A2ed3ce04127d527af4a4187d2c9944612604de61d70a93abbc3f5c6ed98cb6be%22%2C%22last_refreshed%22%3A1542511180.8014497757%7D; rur=ATN; urlgen="{}:1gODfZ:3h97w_2Cpg3f0VTSrZDw5pyC7fY"
origin: https://www.instagram.com
referer: https://www.instagram.com/heeyioep/
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
x-csrftoken: CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu
x-instagram-ajax: 710a1be42428
x-requested-with: XMLHttpRequest
Form-data (parsed):
profile-pic: (binary)
Form-data (source):
------WebKitFormBoundaryf3YOtJCAfKhjZCVf
Content-Disposition: form-data; name="profile_pic"; filename="profilepic.jpg"
Content-Type: image/jpeg
------WebKitFormBoundaryf3YOtJCAfKhjZCVf--
I believe that I have all of the proper headers set. I'm getting a response when sending the request, but it is not changing the profile picture. Any help is greatly appreciated!
python python-3.x https http-headers python-requests
add a comment |
I am trying to change the user profile picture on instagram programmatically via HTTP requests. I'm unsure as to why the profile picture has not updated. I have used many examples on stackoverflow (Upload Image using POST form data in Python-requests) along with the official docs for requests (http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file). Here is the current method I am working on:
def update_profile_pic(self):
get_change_pic = self.session.get('https://www.instagram.com/' + self.username, headers=self.headers)
self.session.headers.update({
'user-agent' : self.user_agent,
'x-csrftoken' : get_change_pic.cookies['csrftoken'],
'content-type' : 'multipart/form-data; boundary=----WebKitFormBoundaryUIboB46mvoIt1m9R',
'referer' : 'https://www.instagram.com/' + self.username + '/',
'origin' : 'https://www.instagram.com'
})
files = {'profile_pic': ('profilepic.jpg',
open('profilepic.jpg', 'rb').read(),
'image/jpeg',
{
'Content-Disposition' : 'form-data;',
}
)}
change_pic = self.session.post('https://www.instagram.com/accounts/web_change_profile_picture/', files=files)
print(change_pic.text)
Here is the response that I get from my program:
{"changed_profile": true, "id": 9129479436, "has_profile_pic": false, "profile_pic_url": "https://instagram.fmkc1-1.fna.fbcdn.net/vp/c012aa3473e225c235b274cb8a51c620/5C716EDF/t51.2885-19/38905493_2193354514245732_6791661364604567552_n.jpg", "profile_pic_url_hd": "https://instagram.fmkc1-1.fna.fbcdn.net/vp/c012aa3473e225c235b274cb8a51c620/5C716EDF/t51.2885-19/38905493_2193354514245732_6791661364604567552_n.jpg", "profile_pic_to_post_upsell_eligible": true, "status": "ok"}
Here is the response I get when manually uploading a pic, via instagram.com:
{"changed_profile": true, "id": 9129479436, "has_profile_pic": true, "profile_pic_url": "https://instagram.fbed1-1.fna.fbcdn.net/vp/827163eecb3fb3ed2cd7969528fd92da/5C6A10A3/t51.2885-19/44785389_226951028028925_6866362025681879040_n.jpg", "profile_pic_url_hd": "https://instagram.fbed1-1.fna.fbcdn.net/vp/827163eecb3fb3ed2cd7969528fd92da/5C6A10A3/t51.2885-19/44785389_226951028028925_6866362025681879040_n.jpg", "status": "ok"}
Response headers:
access-control-allow-credentials: true
access-control-allow-origin: https://www.instagram.com
cache-control: private, no-cache, no-store, must-revalidate
content-encoding: gzip
content-language: en
content-length: 217
content-security-policy: report-uri https://www.instagram.com/security/csp_report/; default-src 'self' https://www.instagram.com; img-src https: data: blob:; font-src https: data:; media-src 'self' blob: https://www.instagram.com https://*.cdninstagram.com https://*.fbcdn.net; manifest-src 'self' https://www.instagram.com; script-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://*.cdninstagram.com wss://www.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' https://*.www.instagram.com https://www.instagram.com 'unsafe-inline'; connect-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://graph.instagram.com https://*.graph.instagram.com https://*.cdninstagram.com https://api.instagram.com wss://www.instagram.com wss://edge-chat.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net chrome-extension://boadgeojelhgndaghljhdicfkmllpafd; worker-src 'self' https://www.instagram.com; frame-src 'self' https://instagram.com https://www.instagram.com https://staticxx.facebook.com https://www.facebook.com https://web.facebook.com https://connect.facebook.net https://m.facebook.com; object-src 'none'; upgrade-insecure-requests
content-type: application/json; charset=utf-8
date: Sun, 18 Nov 2018 03:22:59 GMT
expires: Sat, 01 Jan 2000 00:00:00 GMT
pragma: no-cache
set-cookie: rur=ATN; Domain=.instagram.com; HttpOnly; Path=/; Secure
set-cookie: ds_user_id=9129479436; Domain=.instagram.com; expires=Sat, 16-Feb-2019 03:22:59 GMT; Max-Age=7776000; Path=/; Secure
set-cookie: urlgen="{}:1gODfn:oseVSKSqi_G7dsrw-sGyYnB4UB8"; Domain=.instagram.com; HttpOnly; Path=/; Secure
set-cookie: csrftoken=CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu; Domain=.instagram.com; expires=Sun, 17-Nov-2019 03:22:59 GMT; Max-Age=31449600; Path=/; Secure
status: 200
strict-transport-security: max-age=60
vary: Accept-Language, Cookie, Accept-Encoding
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 0
Request headers:
:authority: www.instagram.com
:method: POST
:path: /accounts/web_change_profile_picture/
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
content-length: 8638
content-type: multipart/form-data; boundary=----WebKitFormBoundaryf3YOtJCAfKhjZCVf
cookie: mid=W_DaPQAEAAGEpui-cKxkbCScmijn; mcd=3; csrftoken=CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu; ds_user_id=9129479436; sessionid=IGSC24a182fcba699695123d686dee80a45615c1368c599d73392433f7a465714a70%3A8Bc4cb2j59ZJJFGKCLXEa4v3uUJBz63g%3A%7B%22_auth_user_id%22%3A9129479436%2C%22_auth_user_backend%22%3A%22accounts.backends.CaseInsensitiveModelBackend%22%2C%22_auth_user_hash%22%3A%22%22%2C%22_platform%22%3A4%2C%22_token_ver%22%3A2%2C%22_token%22%3A%229129479436%3AUgJfZH2OoUcdCLyhaMthiwJgIXATamnB%3A2ed3ce04127d527af4a4187d2c9944612604de61d70a93abbc3f5c6ed98cb6be%22%2C%22last_refreshed%22%3A1542511180.8014497757%7D; rur=ATN; urlgen="{}:1gODfZ:3h97w_2Cpg3f0VTSrZDw5pyC7fY"
origin: https://www.instagram.com
referer: https://www.instagram.com/heeyioep/
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
x-csrftoken: CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu
x-instagram-ajax: 710a1be42428
x-requested-with: XMLHttpRequest
Form-data (parsed):
profile-pic: (binary)
Form-data (source):
------WebKitFormBoundaryf3YOtJCAfKhjZCVf
Content-Disposition: form-data; name="profile_pic"; filename="profilepic.jpg"
Content-Type: image/jpeg
------WebKitFormBoundaryf3YOtJCAfKhjZCVf--
I believe that I have all of the proper headers set. I'm getting a response when sending the request, but it is not changing the profile picture. Any help is greatly appreciated!
python python-3.x https http-headers python-requests
add a comment |
I am trying to change the user profile picture on instagram programmatically via HTTP requests. I'm unsure as to why the profile picture has not updated. I have used many examples on stackoverflow (Upload Image using POST form data in Python-requests) along with the official docs for requests (http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file). Here is the current method I am working on:
def update_profile_pic(self):
get_change_pic = self.session.get('https://www.instagram.com/' + self.username, headers=self.headers)
self.session.headers.update({
'user-agent' : self.user_agent,
'x-csrftoken' : get_change_pic.cookies['csrftoken'],
'content-type' : 'multipart/form-data; boundary=----WebKitFormBoundaryUIboB46mvoIt1m9R',
'referer' : 'https://www.instagram.com/' + self.username + '/',
'origin' : 'https://www.instagram.com'
})
files = {'profile_pic': ('profilepic.jpg',
open('profilepic.jpg', 'rb').read(),
'image/jpeg',
{
'Content-Disposition' : 'form-data;',
}
)}
change_pic = self.session.post('https://www.instagram.com/accounts/web_change_profile_picture/', files=files)
print(change_pic.text)
Here is the response that I get from my program:
{"changed_profile": true, "id": 9129479436, "has_profile_pic": false, "profile_pic_url": "https://instagram.fmkc1-1.fna.fbcdn.net/vp/c012aa3473e225c235b274cb8a51c620/5C716EDF/t51.2885-19/38905493_2193354514245732_6791661364604567552_n.jpg", "profile_pic_url_hd": "https://instagram.fmkc1-1.fna.fbcdn.net/vp/c012aa3473e225c235b274cb8a51c620/5C716EDF/t51.2885-19/38905493_2193354514245732_6791661364604567552_n.jpg", "profile_pic_to_post_upsell_eligible": true, "status": "ok"}
Here is the response I get when manually uploading a pic, via instagram.com:
{"changed_profile": true, "id": 9129479436, "has_profile_pic": true, "profile_pic_url": "https://instagram.fbed1-1.fna.fbcdn.net/vp/827163eecb3fb3ed2cd7969528fd92da/5C6A10A3/t51.2885-19/44785389_226951028028925_6866362025681879040_n.jpg", "profile_pic_url_hd": "https://instagram.fbed1-1.fna.fbcdn.net/vp/827163eecb3fb3ed2cd7969528fd92da/5C6A10A3/t51.2885-19/44785389_226951028028925_6866362025681879040_n.jpg", "status": "ok"}
Response headers:
access-control-allow-credentials: true
access-control-allow-origin: https://www.instagram.com
cache-control: private, no-cache, no-store, must-revalidate
content-encoding: gzip
content-language: en
content-length: 217
content-security-policy: report-uri https://www.instagram.com/security/csp_report/; default-src 'self' https://www.instagram.com; img-src https: data: blob:; font-src https: data:; media-src 'self' blob: https://www.instagram.com https://*.cdninstagram.com https://*.fbcdn.net; manifest-src 'self' https://www.instagram.com; script-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://*.cdninstagram.com wss://www.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' https://*.www.instagram.com https://www.instagram.com 'unsafe-inline'; connect-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://graph.instagram.com https://*.graph.instagram.com https://*.cdninstagram.com https://api.instagram.com wss://www.instagram.com wss://edge-chat.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net chrome-extension://boadgeojelhgndaghljhdicfkmllpafd; worker-src 'self' https://www.instagram.com; frame-src 'self' https://instagram.com https://www.instagram.com https://staticxx.facebook.com https://www.facebook.com https://web.facebook.com https://connect.facebook.net https://m.facebook.com; object-src 'none'; upgrade-insecure-requests
content-type: application/json; charset=utf-8
date: Sun, 18 Nov 2018 03:22:59 GMT
expires: Sat, 01 Jan 2000 00:00:00 GMT
pragma: no-cache
set-cookie: rur=ATN; Domain=.instagram.com; HttpOnly; Path=/; Secure
set-cookie: ds_user_id=9129479436; Domain=.instagram.com; expires=Sat, 16-Feb-2019 03:22:59 GMT; Max-Age=7776000; Path=/; Secure
set-cookie: urlgen="{}:1gODfn:oseVSKSqi_G7dsrw-sGyYnB4UB8"; Domain=.instagram.com; HttpOnly; Path=/; Secure
set-cookie: csrftoken=CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu; Domain=.instagram.com; expires=Sun, 17-Nov-2019 03:22:59 GMT; Max-Age=31449600; Path=/; Secure
status: 200
strict-transport-security: max-age=60
vary: Accept-Language, Cookie, Accept-Encoding
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 0
Request headers:
:authority: www.instagram.com
:method: POST
:path: /accounts/web_change_profile_picture/
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
content-length: 8638
content-type: multipart/form-data; boundary=----WebKitFormBoundaryf3YOtJCAfKhjZCVf
cookie: mid=W_DaPQAEAAGEpui-cKxkbCScmijn; mcd=3; csrftoken=CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu; ds_user_id=9129479436; sessionid=IGSC24a182fcba699695123d686dee80a45615c1368c599d73392433f7a465714a70%3A8Bc4cb2j59ZJJFGKCLXEa4v3uUJBz63g%3A%7B%22_auth_user_id%22%3A9129479436%2C%22_auth_user_backend%22%3A%22accounts.backends.CaseInsensitiveModelBackend%22%2C%22_auth_user_hash%22%3A%22%22%2C%22_platform%22%3A4%2C%22_token_ver%22%3A2%2C%22_token%22%3A%229129479436%3AUgJfZH2OoUcdCLyhaMthiwJgIXATamnB%3A2ed3ce04127d527af4a4187d2c9944612604de61d70a93abbc3f5c6ed98cb6be%22%2C%22last_refreshed%22%3A1542511180.8014497757%7D; rur=ATN; urlgen="{}:1gODfZ:3h97w_2Cpg3f0VTSrZDw5pyC7fY"
origin: https://www.instagram.com
referer: https://www.instagram.com/heeyioep/
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
x-csrftoken: CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu
x-instagram-ajax: 710a1be42428
x-requested-with: XMLHttpRequest
Form-data (parsed):
profile-pic: (binary)
Form-data (source):
------WebKitFormBoundaryf3YOtJCAfKhjZCVf
Content-Disposition: form-data; name="profile_pic"; filename="profilepic.jpg"
Content-Type: image/jpeg
------WebKitFormBoundaryf3YOtJCAfKhjZCVf--
I believe that I have all of the proper headers set. I'm getting a response when sending the request, but it is not changing the profile picture. Any help is greatly appreciated!
python python-3.x https http-headers python-requests
I am trying to change the user profile picture on instagram programmatically via HTTP requests. I'm unsure as to why the profile picture has not updated. I have used many examples on stackoverflow (Upload Image using POST form data in Python-requests) along with the official docs for requests (http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file). Here is the current method I am working on:
def update_profile_pic(self):
get_change_pic = self.session.get('https://www.instagram.com/' + self.username, headers=self.headers)
self.session.headers.update({
'user-agent' : self.user_agent,
'x-csrftoken' : get_change_pic.cookies['csrftoken'],
'content-type' : 'multipart/form-data; boundary=----WebKitFormBoundaryUIboB46mvoIt1m9R',
'referer' : 'https://www.instagram.com/' + self.username + '/',
'origin' : 'https://www.instagram.com'
})
files = {'profile_pic': ('profilepic.jpg',
open('profilepic.jpg', 'rb').read(),
'image/jpeg',
{
'Content-Disposition' : 'form-data;',
}
)}
change_pic = self.session.post('https://www.instagram.com/accounts/web_change_profile_picture/', files=files)
print(change_pic.text)
Here is the response that I get from my program:
{"changed_profile": true, "id": 9129479436, "has_profile_pic": false, "profile_pic_url": "https://instagram.fmkc1-1.fna.fbcdn.net/vp/c012aa3473e225c235b274cb8a51c620/5C716EDF/t51.2885-19/38905493_2193354514245732_6791661364604567552_n.jpg", "profile_pic_url_hd": "https://instagram.fmkc1-1.fna.fbcdn.net/vp/c012aa3473e225c235b274cb8a51c620/5C716EDF/t51.2885-19/38905493_2193354514245732_6791661364604567552_n.jpg", "profile_pic_to_post_upsell_eligible": true, "status": "ok"}
Here is the response I get when manually uploading a pic, via instagram.com:
{"changed_profile": true, "id": 9129479436, "has_profile_pic": true, "profile_pic_url": "https://instagram.fbed1-1.fna.fbcdn.net/vp/827163eecb3fb3ed2cd7969528fd92da/5C6A10A3/t51.2885-19/44785389_226951028028925_6866362025681879040_n.jpg", "profile_pic_url_hd": "https://instagram.fbed1-1.fna.fbcdn.net/vp/827163eecb3fb3ed2cd7969528fd92da/5C6A10A3/t51.2885-19/44785389_226951028028925_6866362025681879040_n.jpg", "status": "ok"}
Response headers:
access-control-allow-credentials: true
access-control-allow-origin: https://www.instagram.com
cache-control: private, no-cache, no-store, must-revalidate
content-encoding: gzip
content-language: en
content-length: 217
content-security-policy: report-uri https://www.instagram.com/security/csp_report/; default-src 'self' https://www.instagram.com; img-src https: data: blob:; font-src https: data:; media-src 'self' blob: https://www.instagram.com https://*.cdninstagram.com https://*.fbcdn.net; manifest-src 'self' https://www.instagram.com; script-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://*.cdninstagram.com wss://www.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' https://*.www.instagram.com https://www.instagram.com 'unsafe-inline'; connect-src 'self' https://instagram.com https://www.instagram.com https://*.www.instagram.com https://graph.instagram.com https://*.graph.instagram.com https://*.cdninstagram.com https://api.instagram.com wss://www.instagram.com wss://edge-chat.instagram.com https://*.facebook.com https://*.fbcdn.net https://*.facebook.net chrome-extension://boadgeojelhgndaghljhdicfkmllpafd; worker-src 'self' https://www.instagram.com; frame-src 'self' https://instagram.com https://www.instagram.com https://staticxx.facebook.com https://www.facebook.com https://web.facebook.com https://connect.facebook.net https://m.facebook.com; object-src 'none'; upgrade-insecure-requests
content-type: application/json; charset=utf-8
date: Sun, 18 Nov 2018 03:22:59 GMT
expires: Sat, 01 Jan 2000 00:00:00 GMT
pragma: no-cache
set-cookie: rur=ATN; Domain=.instagram.com; HttpOnly; Path=/; Secure
set-cookie: ds_user_id=9129479436; Domain=.instagram.com; expires=Sat, 16-Feb-2019 03:22:59 GMT; Max-Age=7776000; Path=/; Secure
set-cookie: urlgen="{}:1gODfn:oseVSKSqi_G7dsrw-sGyYnB4UB8"; Domain=.instagram.com; HttpOnly; Path=/; Secure
set-cookie: csrftoken=CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu; Domain=.instagram.com; expires=Sun, 17-Nov-2019 03:22:59 GMT; Max-Age=31449600; Path=/; Secure
status: 200
strict-transport-security: max-age=60
vary: Accept-Language, Cookie, Accept-Encoding
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 0
Request headers:
:authority: www.instagram.com
:method: POST
:path: /accounts/web_change_profile_picture/
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
content-length: 8638
content-type: multipart/form-data; boundary=----WebKitFormBoundaryf3YOtJCAfKhjZCVf
cookie: mid=W_DaPQAEAAGEpui-cKxkbCScmijn; mcd=3; csrftoken=CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu; ds_user_id=9129479436; sessionid=IGSC24a182fcba699695123d686dee80a45615c1368c599d73392433f7a465714a70%3A8Bc4cb2j59ZJJFGKCLXEa4v3uUJBz63g%3A%7B%22_auth_user_id%22%3A9129479436%2C%22_auth_user_backend%22%3A%22accounts.backends.CaseInsensitiveModelBackend%22%2C%22_auth_user_hash%22%3A%22%22%2C%22_platform%22%3A4%2C%22_token_ver%22%3A2%2C%22_token%22%3A%229129479436%3AUgJfZH2OoUcdCLyhaMthiwJgIXATamnB%3A2ed3ce04127d527af4a4187d2c9944612604de61d70a93abbc3f5c6ed98cb6be%22%2C%22last_refreshed%22%3A1542511180.8014497757%7D; rur=ATN; urlgen="{}:1gODfZ:3h97w_2Cpg3f0VTSrZDw5pyC7fY"
origin: https://www.instagram.com
referer: https://www.instagram.com/heeyioep/
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
x-csrftoken: CQM7TvwBhKbigdcj2a7UVZNaAXB0xGpu
x-instagram-ajax: 710a1be42428
x-requested-with: XMLHttpRequest
Form-data (parsed):
profile-pic: (binary)
Form-data (source):
------WebKitFormBoundaryf3YOtJCAfKhjZCVf
Content-Disposition: form-data; name="profile_pic"; filename="profilepic.jpg"
Content-Type: image/jpeg
------WebKitFormBoundaryf3YOtJCAfKhjZCVf--
I believe that I have all of the proper headers set. I'm getting a response when sending the request, but it is not changing the profile picture. Any help is greatly appreciated!
python python-3.x https http-headers python-requests
python python-3.x https http-headers python-requests
asked Nov 23 '18 at 22:25
TylerTyler
13
13
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53453496%2fuploading-binary-image-to-instagram-post-request%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53453496%2fuploading-binary-image-to-instagram-post-request%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown