Data Analysis

17 views
Skip to first unread message

Risa Saju

unread,
May 20, 2024, 5:40:13 AMMay 20
to Guardian Open Platform API Forum
Hi there,

I am trying to study the STEM industies, Tech industries in Queensland. However when i use the below code, I am getting alot of papers that are not at all related to the keywords. Also when i use the NOT operator, the articles are increasing.

Do you guys have any suggestion?

Thanks in advance


# Define the base URL and search parameters
base_url = 'https://content.guardianapis.com/'
search_string = '"Indigenous students science" OR "STEM fields" OR "STEM courses" or "STEM industries" '


production_office = "aus"
from_date = "2022-05-01"
to_date = "2024-05-16"

# Construct the full URL for the Guardian API search
full_url = base_url + f"search?q={search_string}&production-office={production_office}&from-date={from_date}&to-date={to_date}&show-fields=body&api-key={key}"

# Print the full URL to verify
print(full_url)



Emily Bourke

unread,
May 20, 2024, 5:59:55 AMMay 20
to risa....@gmail.com, guardian...@googlegroups.com
Hi Risa,

I think the issue with the code you’ve sent is that the last “or” is in lowercase instead of uppercase.


Could you give me an example using the NOT operator that didn’t work, and I can look into that?

Best wishes,
Emily

--
You received this message because you are subscribed to the Google Groups "Guardian Open Platform API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guardian-api-t...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/guardian-api-talk/ea0d5069-3f0e-458f-970c-923e1eae363fn%40googlegroups.com.


--
Emily Bourke (she/her)
Software engineer
Content Pipeline team (CoPip)
The Guardian


This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way.  Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software.
 
Guardian News & Media Limited is a member of Guardian Media Group plc. Registered Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP.  Registered in England Number 908396


Reply all
Reply to author
Forward
0 new messages