Skip to content

Instantly share code, notes, and snippets.

View ScottNeaves's full-sized avatar

Scott T Neaves ScottNeaves

  • Richmond, Virginia
View GitHub Profile
@ScottNeaves
ScottNeaves / hangman.py
Created September 10, 2015 03:45
Play hangman in the console with Python!
###############################################################################################################
# Author: Scott Neaves 09/08/2015 #
# Hangman #
# Python v2.7 #
###############################################################################################################
from random import choice
import string
import webbrowser
@ScottNeaves
ScottNeaves / replicate_intermittent_error.sh
Created May 3, 2016 21:18
Intermittent 400 errors on rate and label requests
#!/bin/bash
rand_ints=($RANDOM, $RANDOM, $RANDOM, $RANDOM, $RANDOM, $RANDOM, $RANDOM, $RANDOM, $RANDOM, $RANDOM, $RANDOM, $RANDOM)
#Get Rate
curl --verbose --header "X-PB-Shipper-Rate-Plan: PP_SRP_NEWBLUE" --header "Content-Type: application/json" --header "Authorization: Bearer qM8d3q3rQtrq9p4uow5qskEKMYdg" --header "X-PB-TransactionId: ${rand_ints[0]}" --header "Accept: application/json" --data '{"parcel": {"dimension": {"height": 7, "width": 3, "unitOfMeasurement": "IN", "length": 8}, "weight": {"unitOfMeasurement": "OZ", "weight": 14.0}}, "fromAddress": {"cityTown": "San Jose", "countryCode": "US", "stateProvince": "CA", "name": "Best Western", "postalCode": "95110", "addressLines": ["345 Park Avenue"]}, "rates": [{"inductionPostalCode": "95110", "carrier": "USPS", "specialServices": [{"specialServiceId": "DelCon"}], "parcelType": "PKG", "serviceId": "PM"}], "toAddress": {"cityTown": "Cupertino", "countryCode": "US", "stateProvince": "CA", "name": "Apple", "postalCode": "95014", "addressLines": ["1 Infi
@ScottNeaves
ScottNeaves / payment_account_number.sh
Created May 4, 2016 19:06
Payment Account Number is the same for each request
#!/bin/bash
curl --verbose --header "X-PB-Shipper-Rate-Plan: PP_SRP_NEWBLUE" --header "Content-Type: application/json" --header "Authorization: Bearer 5Es6wB0eAPCoE49VRcYqnQPj9RpH" --header "X-PB-TransactionId: ${rand_ints[1]}" --header "Accept: application/json" --data '{"devUserName": "[email protected]", "shipperRegistration": {"phoneNumber": "5122901212", "address": {"city": "San Jose", "addressLine1": "345 Park Avenue", "state": "CA", "isoCountryCode": "US", "postalCode": "95110"}, "companyName": "Company Name", "fullName": "Customer Name", "emailAddress": "ordoro-pitney-'$RANDOM'@mailinator.com"}, "devPassword": "Vulcan1234"}' --request "POST" 'https://api-sandbox.pitneybowes.com/shippingservices/v1/developers/38196030/merchants/registration'
curl --verbose --header "X-PB-Shipper-Rate-Plan: PP_SRP_NEWBLUE" --header "Content-Type: application/json" --header "Authorization: Bearer 5Es6wB0eAPCoE49VRcYqnQPj9RpH" --header "X-PB-TransactionId: ${rand_ints[1]}" --header "Accept: application/json" --data
{
"fromAddress": {
"addressLines": ["345 Park Ave"],
"cityTown": "San Jose",
"stateProvince": "CA",
"postalCode": "95110",
"countryCode": "US",
"company": "",
"name": "Adobe",
"phone": "5122901212",
{
"fromAddress": {
"addressLines": ["345 Park Ave"],
"cityTown": "San Jose",
"stateProvince": "CA",
"postalCode": "95110",
"countryCode": "US",
"company": "",
"name": "Adobe",
"phone": "5122901212",
{
"fromAddress": {
"addressLines": ["345 Park Avenue"],
"cityTown": "San Jose",
"stateProvince": "CA",
"postalCode": "95110",
"countryCode": "US",
"name": "Adobe"
},
"toAddress": {
INFO:ordoro_requests.core:========== Request POST https://api-sandbox.pitneybowes.com/shippingservices/v1/shipments?includeDeliveryCommitment=True ==========
INFO:ordoro_requests.core:Headers: {'X-PB-TransactionId': '1470154046', 'Connection': 'keep-alive', 'User-Agent': 'python-requests/2.10.0', 'X-PB-Shipper-Rate-Plan': 'PP_SRP_NEWBLUE', 'Authorization': 'Bearer NR80bs3XBmLeRwxdOZ0SU9qXHumG', 'Accept-Encoding': 'gzip, deflate', 'Content-Length': '1157', 'Content-Type': 'application/json', 'Accept': 'application/json'}
DEBUG:ordoro_requests.core:Body: {"toAddress": {"addressLines": ["1 Infinite Loop"], "residential": true, "email": "[email protected]", "company": null, "postalCode": "95014", "cityTown": "Cupertino", "countryCode": "US", "phone": "5122901212", "name": "Apple"}, "parcel": {"dimension": {"unitOfMeasurement": "IN", "height": 7, "width": 3, "length": 8}, "weight": {"unitOfMeasurement": "OZ", "weight": 14.0}}, "documents": [{"printDialogOption": "NO_PRINT_DIALOG", "fileFormat": "PNG", "size": "DOC_4X
INFO:ordoro_requests.core:========== Request POST https://api-sandbox.pitneybowes.com/shippingservices/v1/rates?includeDeliveryCommitment=True ==========
INFO:ordoro_requests.core:Headers: {'Connection': 'keep-alive', 'X-PB-TransactionId': '1470153978', 'Accept-Encoding': 'gzip, deflate', 'Content-Length': '650', 'Authorization': 'Bearer lAssraRCfL3GJFL704RNT1cFnZaZ', 'User-Agent': 'python-requests/2.10.0', 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-PB-Shipper-Rate-Plan': 'PP_SRP_NEWBLUE'}
DEBUG:ordoro_requests.core:Body: {"parcel": {"weight": {"weight": 14.0, "unitOfMeasurement": "OZ"}, "dimension": {"height": 7, "length": 8, "width": 3, "unitOfMeasurement": "IN"}}, "shipmentOptions": [], "rates": [{"specialServices": [{"specialServiceId": "DelCon"}], "parcelType": "PKG", "serviceId": "PM", "inductionPostalCode": "95110", "carrier": "USPS"}], "toAddress": {"addressLines": ["1 Infinite Loop"], "cityTown": "Cupertino", "stateProvince": "CA", "name": "Apple", "countryCode": "US", "post
@ScottNeaves
ScottNeaves / invalid-dates.txt
Last active August 2, 2016 21:31
`fromDate` and `toDate` not working
(.env) Scotts-MBP:skipper3 scottneaves$ curl --verbose --request GET --header "Authorization: Bearer 3duAHMpfAtZlwZR3n4yyeFVlOmo7" --header "Content-Type: application/json" --header "Accept: application/json" --header "Accept_Language: en-US" 'https://api-sandbox.pitneybowes.com/shippingservices/v2/ledger/developers/41806130/transactions/reports?fromDate=trash_value&toDate=garbage_value'
* Trying 52.72.237.59...
* Connected to api-sandbox.pitneybowes.com (52.72.237.59) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.pitneybowes.com
* Server certificate: Symantec Class 3 Secure Server CA - G4
* Server certificate: VeriSign Class 3 Public Primary Certification Authority - G5
> GET /shippingservices/v2/ledger/developers/41806130/transactions/reports?fromDate=trash_value&toDate=garbage_value HTTP/1.1
> Host: api-sandbox.pitneybowes.com
> User-Agent: curl/7.43.0
@ScottNeaves
ScottNeaves / Jenkinsfile
Created November 21, 2017 18:44
Push to GitHub from Jenkins job
node {
// This step utilizes the Workspace Cleanup Plugin: https://wiki.jenkins.io/display/JENKINS/Workspace+Cleanup+Plugin
step([$class: 'WsCleanup'])
}
node {
sshagent (credentials: ['<< insert credentialsId here >>']) {
sh("git clone << your repo here, should be "git@..." like [email protected]:username/reponame.git >>")
}
}
node {