This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Error: | |
InvalidArgumentError: Unknown image file format. One of JPEG, PNG, GIF, BMP required. | |
Find the images using the following code and delete those images from the dataset. | |
""" | |
from pathlib import Path | |
import imghdr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send_request(url, HEADERS): | |
with TorRequests() as tor_requests: | |
with tor_requests.get_session() as sess: | |
# print the IP address of the proxy | |
print(sess.get("http://httpbin.org/ip").json()) | |
# pause randomly between 1 to 3 seconds | |
time.sleep(random.randint(1, 3)) | |
html_content = sess.get(url, headers=HEADERS, timeout=10).text | |
# your scraping code here .. | |
print(HEADERS["User-Agent"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from email.header import Header | |
from wsgiref import headers | |
from torpy.http.requests import TorRequests | |
import requests | |
import urllib3 | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
import random | |
# https://developers.whatismybrowser.com/useragents/explore/operating_system_name/linux/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torpy.http.requests import TorRequests | |
import requests | |
import urllib3 | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
def send_request(url): | |
with TorRequests() as tor_requests: | |
with tor_requests.get_session() as sess: | |
# print the IP address of the proxy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_bigquery_table(df, dataset_tablename, gcp_project_name): | |
# df: your pandas dataframe | |
# dataset_tablename (str.str): dataset_name.tablename | |
# gcp_project_name: GCP Project ID | |
df.to_gbq( | |
destination_table=destination_table_name, | |
project_id=gcp_project_name, | |
if_exists="replace", # 3 available methods: fail/replace/append | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
final wordPair = WordPair.random(); | |
return MaterialApp( | |
theme: ThemeData(primaryColor: Colors.black), |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"meta": { | |
"theme": "stackoverflow", | |
"whatever": { | |
"x" : "dsdsds", | |
"y" : [], | |
"z": { | |
"z1": 1, | |
"z2": "2" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval `ssh-agent -s` | |
ssh-add | |
git add . | |
git commit -m "update message" | |
git push origin master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = df[df['text'].str.split().str.len() > 10] |
NewerOlder