nebius/SWE-bench-extra huggingface dataset:
Repository: oasis-open/cti-taxii-client

Issue:
Check for trailing slash in URLs
```
>>> collection = Collection('http://localhost:5000/trustgroup1/collections/91a7b528-80eb-42ed-a74d-c6fbd5a26116', user='user1', password='Password1')
>>> collection.get_object('indicator--252c7c11-daf2-42bd-843b-be65edca9f61')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/lu/Projects/cti-taxii-client/taxii2client/__init__.py", line 483, in get_object
    params=query_params)
  File "/home/lu/Projects/cti-taxii-client/taxii2client/__init__.py", line 876, in get
    resp.raise_for_status()
  File "/home/lu/.virtualenvs/cti-taxii-client/lib/python3.6/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: NOT FOUND for url: http://localhost:5000/trustgroup1/collections/91a7b528-80eb-42ed-a74d-c6fbd5a26116objects/indicator--252c7c11-daf2-42bd-843b-be65edca9f61/
```

If I set up the collection with a `/` at the end of the url, it works fine because it's not trying to find a collection called `91a7b528-80eb-42ed-a74d-c6fbd5a26116objects`.


Comments:

Patch:
diff --git a/taxii2client/__init__.py b/taxii2client/__init__.py
index 548f279..edd90b5 100644
--- a/taxii2client/__init__.py
+++ b/taxii2client/__init__.py
@@ -159,7 +159,12 @@ class _TAXIIEndpoint(object):
         else:
             self._conn = _HTTPConnection(user, password, verify)
 
-        self.url = url
+        # Add trailing slash to TAXII endpoint if missing
+        # https://github.com/oasis-open/cti-taxii-client/issues/50
+        if url[-1] == "/":
+            self.url = url
+        else:
+            self.url = url + "/"
 
     def close(self):
         self._conn.close()


Test patch:
diff --git a/taxii2client/test/test_client.py b/taxii2client/test/test_client.py
index e363d27..db2ff84 100644
--- a/taxii2client/test/test_client.py
+++ b/taxii2client/test/test_client.py
@@ -960,3 +960,15 @@ def test_server_with_custom_properties(server):
     server.refresh()
     assert len(server.custom_properties) == 1
     assert server.custom_properties["x_example_com"] == "some value"
+
+
+@responses.activate
+def test_collection_missing_trailing_slash():
+    set_collection_response()
+    collection = Collection(COLLECTION_URL[:-1])
+    responses.add(responses.GET, GET_OBJECT_URL, GET_OBJECT_RESPONSE,
+                  status=200, content_type="%s; charset=utf-8" % MEDIA_TYPE_STIX_V20)
+
+    response = collection.get_object("indicator--252c7c11-daf2-42bd-843b-be65edca9f61")
+    indicator = response["objects"][0]
+    assert indicator["id"] == "indicator--252c7c11-daf2-42bd-843b-be65edca9f61"