Tag: request

Ruby Post请求:PDF文件

上传文档的API示例是这样的 headers = { ‘Authorization’: ‘Bearer ACCESS_TOKEN’, } params = { ‘doctor’: ‘https://drchrono.com/api/doctors/1234’, ‘patient’: ‘https://drchrono.com/api/patients/5678’, ‘description’: ‘Short document description here’, ‘date’: ‘2014-02-24’, ‘metatags’: json.dumps([‘tag1’, ‘tag2’]), } with open(‘/path/to/your.pdf’, ‘rb’) as f: files = {‘document’: f} requests.post( ‘https://drchrono.com/api/documents’, data=params, files=files, headers=headers, ) 我使用Prawn来创建PDF。 一个路由自动下载PDF,而另一个路由使其在浏览器中查看。 我遇到了问题(试图弄清楚它是Prawn PDF问题还是PDF问题)我从网上下载了一个相当基本的PDF。 同样的问题。 我正在使用HTTParty发送我的POST请求。 headers = {‘Authorization’ => ‘Bearer ‘ + access_token} […]