'How to add a variable contains a string to url imported from another file?

I am writing a test in Behave with Python. In environment.py I have declared a url variable with a URL. In step.py I wrote a function that calls this environment.url and I want to add to the URL a string that is saved in another variable. This is the code:

@when('I call for a GET request for user {user}')
def my_user(context, user):
    response = requests.get(environment.url, user)

When I print environment.url it prints the correct URL. When I print the user it prints the correct user coming from the feature file. But I cannot add them together!

I tried + '/jhon' and it works fine, but when I try with the variable it doesn't.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source