Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python requests library in AWS Glue

Can you use the Python's request library in AWS Glue? Is there a replacement to the Requests library that can be used with Glue since Glue only supports pure python modules?

like image 766
Aaron Avatar asked Apr 24 '26 03:04

Aaron


1 Answers

You can use the urllib package.

From the Documentation:

urllib is a package that collects several modules for working with URLs:

  • urllib.request for opening and reading URLs
  • urllib.error containing the exceptions raised by urllib.request
  • urllib.parse for parsing URLs
  • urllib.robotparser for parsing robots.txt files

A simple get request using requests

import requests
r=requests.get('http://www.python.org/')
print(r.text)

Alternative using urllib

import urllib.request
r=urllib.request.urlopen('http://www.python.org/').read()
print(r)
like image 89
Bitto Bennichan Avatar answered Apr 25 '26 17:04

Bitto Bennichan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!