> For the complete documentation index, see [llms.txt](https://lauradang.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lauradang.gitbook.io/notes/web/web-scraping/requests-and-json.md).

# Requests And Json

### Webscraping with XHR

1. Inspect page
2. Navigate to Network > XHR > Name
3. Open in new tab or curl
4. Figure out pagination pattern from json link
5. Check if get or post (Copy > Copy Request Headers
6. Add parameters ()

```python
import re

resp = requests.post(
    "https://data.fcm.ca/dynamics/projects",
    data={
        "f": "gmfprojects",
        "p": "%",
        "p1": page_num,
        "c": "en"
    }
)

resp = requests.get(
    "https://data.fcm.ca/dynamics/projects",
    params={
        "f": "gmfprojects",
        "p": "%",
        "p1": page_num,
        "c": "en"
    }
)
```

### Extract JSON Data

```python
  for element in data[index]['name']['name']....:
  print(element)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lauradang.gitbook.io/notes/web/web-scraping/requests-and-json.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
