Repository: digitalocean/pynetbox (python)

Issue:
v2.3.4 of NetBox adds an extra backslash ("/") between hostname and URL 
### Issue type
[X] Bug report      <!-- Unexpected or erroneous behavior -->

### Environment
* Python version:  3.5
* NetBox version:  2.3.4
* PyNetBox version: 3.3.1

### Description
Using `pynetbox` querying against an instance of `NetBox` running `v2.3.3` works fine.
However, when I switch the URL to an instance of `NetBox` running `v2.3.4`, it stops working.

The details and code for each version are below (the same exact data is in both versions of `NetBox`).

---

(`v2.3.3`)
```
>>> try:
...     nb.dcim.sites.get(slug='0am')
... except pynetbox.lib.query.RequestError as e:
...     print(e.req.url)
...
0am
```

---

(`v2.3.4`)
```
>>> try:
...     nb.dcim.sites.get(slug='0am')
... except pynetbox.lib.query.RequestError as e:
...     print(e)
...
The request failed with code 404 Not Found
>>> try:
...     nb.dcim.sites.get(slug='0am')
... except pynetbox.lib.query.RequestError as e:
...     print(e.req.url)
...
http://myhost:8080//api/dcim/sites/?slug=0am
```

---

Notice the extra `/` between the hostname and the rest of the URL?
I'm close to positive that is what is causing the issue.
However, when using the `SwaggerUI` and performing the same action via a `PUT` request, no issues.
So I'm not sure if the error exists in `NetBox` since that is what changed or `pynetbox` since everything **else** in `v2.3.4` works fine.


Pull request description:
Fixes #61 - URL with trailing frontslash
Sanitizes the url positional argument given to Api() to remove a trailing frontslash if it's passed.

Patch:
diff --git a/pynetbox/api.py b/pynetbox/api.py
index b68ce01..fceff1e 100644
--- a/pynetbox/api.py
+++ b/pynetbox/api.py
@@ -89,7 +89,7 @@ class Api(object):
             raise ValueError(
                 '"private_key" and "private_key_file" cannot be used together.'
             )
-        base_url = "{}/api".format(url)
+        base_url = "{}/api".format(url if url[-1] != '/' else url[:-1])
 
         self.api_kwargs = {
             "token": token,


Test patch:
diff --git a/tests/test_api.py b/tests/test_api.py
index 3b5f558..f4ba9bb 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -41,6 +41,18 @@ class ApiTestCase(unittest.TestCase):
         )
         self.assertTrue(api)
 
+    @patch(
+        'pynetbox.lib.query.requests.post',
+        return_value=Response(fixture='api/get_session_key.json')
+    )
+    def test_sanitize_url(self, mock):
+        api = pynetbox.api(
+            'http://localhost:8000/',
+            **def_kwargs
+        )
+        self.assertTrue(api)
+        self.assertEqual(api.api_kwargs['base_url'], 'http://localhost:8000/api')
+
 
 class ApiArgumentsTestCase(unittest.TestCase):