Results 1 to 5 of 5
  1. #1

    Upload Automation and Authorization

    Right. I'm trying to write a script to automatically upload a metric crapton of submissions for a friend, along with going through and adding/updating navigation because weasyl's folder nav is so very subpar for what we were expecting.

    I can request pages, and submit forms, but I'm getting stuck at the login step. I keep getting the "nope, sorry. Doesn't look valid" response (which is frustratingly returned as "200 OK". No, it's not OK. Use 403 or something).

    My current code does as follows:
    Grab /signin
    Stash away any cookies I got from the response
    Parse out the data-csrf-token value
    Submit a "application/x-www-form-urlencoded" with the token, username, password, referer fields filled (I'll probably dump referer if I can), and toss back any cookies

    The response to that last step is where I get the nope page.

    The User-Agent is "Weaslysphere/0.1"

    How do I get a proper login done? I'm sure whatever it is I'm doing or not doing will cause problems with other forms as well.

    I'm sure I'm doing something wrong (it took me a couple of hours to figure out I was replacing the output, not appending to it, when trying to get my multipart/form-data code working).

  2.   Click here to go to the next staff post in this thread.   #2
    you should probably look over http://projects.weasyl.com/weasylapi/ if you haven't already—POSTing to the login form is not the best way to issue authorized requests.

  3. #3
    Is there a way to upload or edit submissions via the API? Or does API authorization work for non-API pages?

  4.   This is the last staff post in this thread.   #4
    API authorization works for (almost) all pages. there's not yet any API endpoints which do writes (as opposed to the current read-only endpoints), but I believe there's a ticket open and work being done on it.

  5. #5
    Do I still need to worry about whatever's keeping me from logging in as far as it also keeping me from uploading things?

    Edit: Never mind, just tried it. I wish I had known API keys worked on all pages from the beginning X3
    Last edited by Socks the Fox; 10-17-2014 at 01:29 PM.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •