Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to upload; possible 302 redirect from slack? #3

Closed
cbowns opened this issue Jun 25, 2015 · 9 comments
Closed

Fails to upload; possible 302 redirect from slack? #3

cbowns opened this issue Jun 25, 2015 · 9 comments

Comments

@cbowns
Copy link

cbowns commented Jun 25, 2015

I've been plugging away at this for a bit and can't get it to work. I think I've got a proper cookie set up (via #2), but my uploads simply fail to go through. Looking at this traffic through Runscope vs an in-browser request with Chrome, it looks like Slack is returning a 302 to the main request the script makes.

If I toggle allow_redirects to allow_redirects=True, I get a <Response [200]> after r.raise_for_status(), but the upload itself is still not working. Any ideas on how to debug this further?

@gabeos
Copy link

gabeos commented Jul 9, 2015

same issue.. took same debug steps as @cbowns

@smashwilson
Copy link
Owner

Strange. I'm expecting that Slack just changed something about the way their web application behaves, and this script didn't follow. (It was a terrible, one-hour hack to begin with 😉) Maybe there's additional verification on the request, now?

@thatarchguy
Copy link

I'm seeing this same behaviour. Currently trying to upload all the pokemon emoji's 😄

@supereli
Copy link

supereli commented Jun 7, 2016

A 302 re-direct actually means the upload worked (strangley enough). They will return a 200 if it doesn't work. The likely problem is that the image doesn't fit their image standards (128x128 max pixels and 64K in size). I'm using a modified version of this script successfully still. I wrote some additional code to downsample images that exceed their maxsize before uploading. Working on integrating it a bit better with what's here and creating a pull request.

@kvarga
Copy link
Collaborator

kvarga commented Jul 31, 2016

I've put in a pull request ( #6 ) that will throw exception w/ Slack error (Most likely the 128x128 limit)

@kvarga
Copy link
Collaborator

kvarga commented Aug 1, 2016

The script should now give a clearer message if there is an error uploading an emoji. The issue is that Slack returns at 200 OK and then displays an error_alert box on the web page. I've resolved this by checking the page for the presence of the alert and throwing an exception, if necessary.

@kvarga kvarga closed this as completed Aug 1, 2016
@HaloZero
Copy link

HaloZero commented Aug 2, 2016

I'm still getting this issue. The page I'm getting redirected to is the login page. I'm wondering if the document.cookie part doesn't work. Have the latest master

@kvarga
Copy link
Collaborator

kvarga commented Aug 2, 2016

Nope, that definitely doesn't work. I tried it, but I must not have re-sourced the .env file. document.cookie can't get the https only cookies. Will fix documentation now.

@kvarga kvarga reopened this Aug 2, 2016
@kvarga
Copy link
Collaborator

kvarga commented Aug 2, 2016

Cleaned up! #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants