Skip to content

Commit

Permalink
readme tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeAdamss committed May 20, 2024
1 parent c1afc56 commit 6ec965a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dpytools/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ from dpytools.http.base import BaseHTTPClient

http_client = BaseHTTPClient()

response = http_client.get(url="http://example.org")
response = http_client.get("http://example.org")
```

`response` is a `requests.Response` object, with all of the properties and methods you would expect such an object to have. For example, to view the status code of the response:
Expand Down Expand Up @@ -48,7 +48,7 @@ from dpytools.http.base import BaseHTTPClient

http_client = BaseHTTPClient()

response = http_client.post(url="http://example.org", *args, **kwargs)
response = http_client.post("http://example.org", *args, **kwargs)
```

As with the `get()` method, `response` is a `requests.Response` object. Since this is a `POST` request, it is likely that you would want to pass additional information to the server, which you can do using keyword arguments. For example, to pass a dictionary as JSON to the processing server:
Expand All @@ -70,6 +70,10 @@ response = http_client.post(

If the `POST` request fails for a network-related reason, this will raise an `HTTPError`.

#### `put()`

The `put()` method follows the same patterns as `post()` and again returns a `requests.Response` object and again propogates additional `*args` and `**kwargs` through to requests.

### UploadServiceClient

The `UploadServiceClient` class facilitates the process of uploading a file to the [dp-upload-service](https://github.com/ONSdigital/dp-upload-service). It implements methods for uploading CSV and SDMX files to the DP Upload Service. Which method you use will depend on whether you are accessing the `/upload` or `upload-new` endpoint. Details on using each method are provided below.
Expand Down

0 comments on commit 6ec965a

Please sign in to comment.