title: How can I run a single only once request for with Locust (Python)
body: <p>There's a notion of <code>SetUp Thread Group</code> with <code>Number of Threads (users)</code> possibility on <code>JMeter</code> but when using <code>Locust</code>, the <code>on_start()</code> method is running as the same amount of users.</p>
  <p>My workaround.</p>
  <pre class="lang-py prettyprint-override"><code>@events.test_start.add_listener
  def _(environment, **kwargs):
      global token
      token = get_token(environment.host)
  </code></pre>
  <p>...</p>
  <pre class="lang-py prettyprint-override"><code>def get_token():
     r = requests.post(host+'/url/token', headers={}, ...)
     return r.text
  </code></pre>
  <p>To be honest, I don't really like that workaround.</p>
  <p>I only need to get a Token <code>once</code>. I can reuse that token and also, it's a really heavy call (because the amount of validations), so I don't want that call to be executed each time for each user.</p>
  <p>Is there a possible way to create a <code>Only Once</code> request that handles this at the beginning of the test?</p>
  <p>Any ideas </p>
  <p>Edited: This is related to Locust library NOT JMeter.</p>