python 3.x - Python3 - Error posting data to a stikked instance -


i'm writing python 3 (3.5) script act simple command line interface user's stikked install. api pretty straight forward, , documentation available.

my post function is:

def submit_paste(paste):     global settings      data = {         'title':   settings['title'],         'name':    settings['author'],         'text':    paste,         'lang':    settings['language'],         'private': settings['private']     }      data = bytes(urllib.parse.urlencode(data).encode())     print(data)     handler = urllib.request.urlopen(settings['url'], data)     print(handler.read().decode('utf-8')) 

when run script, printed output of data, , message returned api. data encoding looks correct me, , outputs:

b'private=0&text=hello%2c+world%0a&lang=text&title=untitled&name=jacob' 

as can see, contains text= attribute, 1 required api call work. i've been able post api using curl shown in link.

the actual error produced api is:

error: missing paste text

is text attribute somehow being encoded incorrectly?

turns out problem wasn't post function, url. virtual host automatically forwards http traffic https. apparently, apache drops post variables when forwards.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -