Questions tagged [hug]

Hug is Python3 API development framework built upon falcon.

Hug aims to make developing Python driven APIs as simple as possible, but no simpler. As a result, it drastically simplifies Python API development.

31 questions
1
vote
1 answer

Vue.js return undefined data after CORS consult in hug server

I want to get data from localhost API from hug server to vue client. I have this code in vue.js:
{{ documents }}
1
vote
0 answers

what is the meaning of providing : in python functions

I am going through a python code which uses the hug framework as shown below: @hug.post("/{scan_id}/files", versions=1, input_format=hug.input_format.multipart) def add_files(request, scan_id: uuid): pass Now the above code works fine…
Naggappan Ramukannan
  • 2,564
  • 9
  • 36
  • 59
1
vote
1 answer

Tensorflow session.run( ) doesn't work with HUG

I am struggling with tensorflow session.run() with hug in python. If I run session.run() without HUG for predicting, It is fine. But, if I run this on hug, it doesn't make any result (even any error). Did anyone come across such scenario? Please…
1
vote
0 answers

API with hug Framework on Windows Server 2012R2 with IIS8

I am trying to get a hug api running on a windows Server 2012 R2. I configuered the server like seen in an Django Example(here). I created a virtual enviroment and installed hug. If I try to run the happy_birthday example with the command: python…
tatatoto
  • 138
  • 1
  • 12
1
vote
1 answer

return GIF image with Hug API (image does not animate on browser)

Hi I have the following code @hug.get('/getgif', output=hug.output_format.image('gif')) def get(username: str, password: str): dir_path = os.path.dirname(__file__) img_path = os.path.join(dir_path, 'animation.gif') …
Timothy Leung
  • 1,407
  • 7
  • 22
  • 39
1
vote
1 answer

Access HTTP PUT data in python hug

import hug something = {'foo': 'bar'} @hug.put('/') def update_something(): something['foo'] = How do I access the put data so that I can update something? I looked up this and this but couldn't find…
Lokesh Meher
  • 437
  • 4
  • 15
0
votes
1 answer

Animated GIF images getting pixelated when saving gif image with Python Image Library(PIL)

I am trying to create an image upload utility in Hug / python and wanted to save images and gifs. But on uploading some of the gif images, the gif images seem to be a lot pixelated. Given below is the code snippet that I am using in the upload…
0
votes
1 answer

hug create GET endpoint to download created word document

I'm working with Python hug API would like to create a GET API for the frontend. The frontend can download a created word document file e.g. via download button. However, after going through a documentation, I still cannot figure out a way to do…
titipata
  • 5,321
  • 3
  • 35
  • 59
0
votes
1 answer

Passing parameters in hug server as /foo/something in double number function

I want to get the double of one number when I access to URL /double/ in hug server. Something like routing in flask. Is it possible to do that? In documentation of hug server, I did not found nothing: My code would seem…
somenxavier
  • 1,206
  • 3
  • 20
  • 43
0
votes
1 answer

Change bind address on hug API

Can anyone tell me how to change the bind-address on the hug API form 127.0.0.1 to 0.0.0.0, please I have been looking around the internet and the only thing I can find is how to change the port number
Conor Donohoe
  • 317
  • 1
  • 3
  • 18
0
votes
1 answer

How can I access a local hug API using JavaScript?

I have an Apache2 web server as well as a Python hug server running. Both run on different ports. I now want to sent a request to the hug server using jQuery. As this is cross domain, I think I have to use something similar to this: How do I send an…
zugabe
  • 31
  • 3
0
votes
1 answer

Python Hug REST API consumed in .NET, JSON looks weird

When consuming a Hug REST endpoint from .net JSON has embedded characters. A complete failing example posted below. Any help greatly appreciated. Python @hug.post('/test') def test(response, body=None): input = body.get('input') …
0
votes
2 answers

hug can't read environment variables

I'm trying to use a environment variables with hug. However, I can't. first step how i did: $ export INTEGER=5 I have this in my main code: import hug import os @hug.get('/') def foo(): var = os.environ['INTEGER'] return {'INT':var} when…
Maverick94
  • 227
  • 4
  • 15
0
votes
1 answer

basic auth not working in python hug

I'm trying to set up basic auth and testing with postman. The code snippet below returns null when tested with Postman with Username and Password set correctly in the Basic Auth section. If I replace the hug.authentication.verify with my own…
James Wilson
  • 852
  • 13
  • 29
-1
votes
1 answer

Forcing content type to application/json for python hug method

AWS's SNS POSTs a json body but sets the CONTENT-TYPE header to text/plain. Is there a way to tell hug to interpret text/plain as if it is application/json so I can get it to do the parsing and validation for me?
monty0
  • 1,759
  • 1
  • 14
  • 22